mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
feat: replace menu with new design (#4012)
Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
@@ -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';
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user