mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
import clsx from 'clsx';
|
|
|
|
import type { MenuProps } from '../menu.types';
|
|
import * as styles from '../styles.css';
|
|
import * as desktopStyles from './styles.css';
|
|
|
|
export const DesktopMenu = ({
|
|
children,
|
|
items,
|
|
portalOptions,
|
|
rootOptions,
|
|
contentOptions: {
|
|
className = '',
|
|
style: contentStyle = {},
|
|
...otherContentOptions
|
|
} = {},
|
|
}: MenuProps) => {
|
|
return (
|
|
<DropdownMenu.Root {...rootOptions}>
|
|
<DropdownMenu.Trigger asChild>{children}</DropdownMenu.Trigger>
|
|
|
|
<DropdownMenu.Portal {...portalOptions}>
|
|
<DropdownMenu.Content
|
|
className={clsx(
|
|
styles.menuContent,
|
|
desktopStyles.contentAnimation,
|
|
className
|
|
)}
|
|
sideOffset={5}
|
|
align="start"
|
|
style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }}
|
|
{...otherContentOptions}
|
|
side="bottom"
|
|
>
|
|
{items}
|
|
</DropdownMenu.Content>
|
|
</DropdownMenu.Portal>
|
|
</DropdownMenu.Root>
|
|
);
|
|
};
|