mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
feat: replace tooltip with new design (#3969)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
export * from './tooltip';
|
||||
@@ -1,40 +0,0 @@
|
||||
import { NoSsr } from '@mui/material';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
import { styled } from '../../styles';
|
||||
import { Popper, type PopperProps } from '../popper';
|
||||
import StyledPopperContainer from '../shared/container';
|
||||
|
||||
const StyledTooltip = styled(StyledPopperContainer)(() => {
|
||||
return {
|
||||
display: 'inline-flex',
|
||||
minHeight: '38px',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
flexShrink: 0,
|
||||
backgroundColor: 'var(--affine-tooltip)',
|
||||
borderRadius: '4px',
|
||||
color: 'var(--affine-white)',
|
||||
padding: '5px 12px',
|
||||
};
|
||||
});
|
||||
|
||||
interface TooltipProps {
|
||||
content: string | ReactElement<any, any>;
|
||||
placement?: PopperProps['placement'];
|
||||
children: ReactElement<any, any>;
|
||||
}
|
||||
export const Tooltip = (props: PopperProps & Omit<TooltipProps, 'title'>) => {
|
||||
const { content, placement = 'top-start', children } = props;
|
||||
return (
|
||||
<NoSsr>
|
||||
<Popper
|
||||
{...props}
|
||||
content={<StyledTooltip placement={placement}>{content}</StyledTooltip>}
|
||||
>
|
||||
{children}
|
||||
</Popper>
|
||||
</NoSsr>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user