blob: bac307fef14777bcb5a84be086ccc6a37175561c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { Button, DialogTrigger, Icon, Menu, Popover } from '@umami/react-zen';
import type { Key, ReactNode } from 'react';
import { Ellipsis } from '@/components/icons';
export function MenuButton({
children,
onAction,
isDisabled,
}: {
children: ReactNode;
onAction?: (action: string) => void;
isDisabled?: boolean;
}) {
const handleAction = (key: Key) => {
onAction?.(key.toString());
};
return (
<DialogTrigger>
<Button variant="quiet" isDisabled={isDisabled}>
<Icon>
<Ellipsis />
</Icon>
</Button>
<Popover placement="bottom start">
<Menu aria-label="menu" onAction={handleAction} style={{ minWidth: '140px' }}>
{children}
</Menu>
</Popover>
</DialogTrigger>
);
}
|