1 import type { CSSProperties, FC, PropsWithChildren } from 'react';
3 import { c } from 'ttag';
5 import type { ButtonLikeShape, ButtonLikeSize } from '@proton/atoms';
6 import { Button, NotificationDot } from '@proton/atoms';
15 } from '@proton/components';
16 import type { DropdownSize } from '@proton/components/components/dropdown/utils';
17 import clsx from '@proton/utils/clsx';
19 export type QuickActionsDropdownProps = {
21 color?: 'weak' | 'norm';
23 dropdownClassname?: string;
24 dropdownHeader?: string;
25 dropdownSize?: DropdownSize;
28 menuClassName?: string;
30 originalPlacement?: PopperPlacement;
32 shape?: ButtonLikeShape;
34 size?: ButtonLikeSize;
35 style?: CSSProperties;
38 export const QuickActionsDropdown: FC<PropsWithChildren<QuickActionsDropdownProps>> = ({
46 icon = 'three-dots-vertical',
57 const { anchorRef, isOpen, toggle, close } = usePopperAnchor<HTMLButtonElement>();
62 className={clsx(className, signaled && 'relative')}
67 evt.stopPropagation();
75 title={dropdownHeader ?? c('Action').t`More options`}
77 <Icon name={icon} size={iconSize} />
78 {signaled && <NotificationDot className="absolute top-0 right-0 w-2 h-2" />}
85 originalPlacement={originalPlacement}
87 contentProps={{ className: dropdownClassname }}
90 {dropdownHeader && <div className="text-bold px-4 my-2">{dropdownHeader}</div>}
91 <DropdownMenu className={menuClassName}>{children}</DropdownMenu>