feat: replace menu with new design (#4012)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Qi
2023-09-06 12:36:43 +08:00
committed by GitHub
parent ef3d3a34e2
commit d8c9f10bc1
51 changed files with 611 additions and 739 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
export * from './menu';
// export { StyledMenuItem as MenuItem } from './styles';
/**
* @deprecated
* Use @toeverything/components/menu instead, this component only used in bookmark plugin, since it support set anchor as Range
*/
export * from './menu-item';
export * from './menu-trigger';
export * from './pure-menu';
@@ -1,20 +0,0 @@
import { ArrowDownSmallIcon } from '@blocksuite/icons';
import { Button, type ButtonProps } from '@toeverything/components/button';
import { forwardRef } from 'react';
export const MenuTrigger = forwardRef<HTMLButtonElement, ButtonProps>(
({ children, ...props }, ref) => {
return (
<Button
// type="plain"
ref={ref}
icon={<ArrowDownSmallIcon />}
iconPosition="end"
{...props}
>
{children}
</Button>
);
}
);
MenuTrigger.displayName = 'MenuTrigger';
-41
View File
@@ -1,41 +0,0 @@
import type { TooltipProps } from '@mui/material';
import type { CSSProperties } from 'react';
import { Popper, type PopperProps } from '../popper';
import { StyledMenuWrapper } from './styles';
export type MenuProps = {
width?: CSSProperties['width'];
menuStyles?: CSSProperties;
} & PopperProps &
Omit<TooltipProps, 'title' | 'content' | 'placement'>;
export const Menu = (props: MenuProps) => {
const {
width,
menuStyles,
content,
placement = 'bottom-start',
children,
...popperProps
} = props;
return content ? (
<Popper
placement={placement}
{...popperProps}
showArrow={false}
content={
<StyledMenuWrapper
width={width}
placement={placement}
style={menuStyles}
>
{content}
</StyledMenuWrapper>
}
>
{children}
</Popper>
) : null;
};
export default Menu;