import { Fragment, FunctionComponent, ReactNode } from 'react' import { Listbox, Transition } from '@headlessui/react' import Tooltip from './Tooltip' import { useTranslation } from 'next-i18next' type DropMenuProps = { button: ReactNode buttonClassName?: string disabled?: boolean onChange: (...args: any[]) => any options: Array toolTipContent?: string value?: any } const DropMenu: FunctionComponent = ({ button, buttonClassName, disabled, value, onChange, options, toolTipContent, }) => { const { t } = useTranslation('common') return (
{({ open }) => ( <> {toolTipContent && !open ? ( {button} ) : ( button )} {options.map((option) => ( {({ selected }) => (
{option.icon ? (
{option.icon}
) : null} {t(option.name.toLowerCase())}
)}
))}
)}
) } export default DropMenu