feat: add tooltip & popover

This commit is contained in:
QiShaoXuan
2022-10-17 18:01:09 +08:00
parent 7eb1bbb5e9
commit 73d7709e54
10 changed files with 671 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
import { styled } from '@/styles';
import type { ReactNode, CSSProperties } from 'react';
import type { PopoverDirection } from './interface';
export interface PopoverContainerProps {
children?: ReactNode;
/**
* The pop-up window points to. The pop-up window has three rounded corners, one is a right angle, and the right angle is the direction of the pop-up window.
*/
direction: PopoverDirection;
style?: CSSProperties;
}
const border_radius_map: Record<PopoverContainerProps['direction'], string> = {
none: '10px',
'left-top': '0 10px 10px 10px',
'left-bottom': '10px 10px 10px 0',
'right-top': '10px 0 10px 10px',
'right-bottom': '10px 10px 0 10px',
};
export const PopoverContainer = styled('div')<
Pick<PopoverContainerProps, 'direction'>
>(({ theme, direction, style }) => {
return '';
// const shadow = theme.affine.shadows.shadow1;
// const white = theme.affine.palette.white;
//
// const borderRadius =
// border_radius_map[direction] || border_radius_map['left-top'];
// return {
// boxShadow: shadow,
// borderRadius: borderRadius,
// padding: '8px 4px',
// backgroundColor: white,
// ...style,
// };
});