import { PropsWithChildren, ReactNode } from 'react'; import { ChevronDown } from 'lucide-react'; import { Menu, MenuButton as ReachMenuButton, MenuLink as ReachMenuLink, MenuList, } from '@reach/menu-button'; import clsx from 'clsx'; import { UISrefProps, useSref } from '@uirouter/react'; import { AutomationTestingProps } from '@/types'; import { Icon } from '@@/Icon'; import { Props as ButtonProps, ButtonWithRef } from './Button'; export interface MenuButtonProps extends Omit, AutomationTestingProps { items: Array; menuClassName?: string; dropdownPosition?: 'left' | 'right'; children: ReactNode; } export function MenuButton({ items, children, color = 'primary', size = 'small', disabled = false, className, title, icon, menuClassName, dropdownPosition = 'right', 'data-cy': dataCy, }: PropsWithChildren) { return ( {children} {items} ); } interface MenuLinkProps extends AutomationTestingProps, UISrefProps { children: ReactNode; label?: string; } export function MenuButtonLink({ to, children, label, params, options, 'data-cy': dataCy, }: MenuLinkProps) { const anchorProps = useSref(to, params, options); return ( {children} ); }