import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/react'; import { ChevronDownIcon } from '@heroicons/react/16/solid'; import clsx from 'clsx'; export type ListItem = { id: number; value: string; label?: string; hrEnabled?: boolean; onClick: (item: ListItem) => void; }; type SelectDropdownProps = { items: ListItem[]; title?: string; placeholder?: string; end?: boolean; color?: 'blue' | 'red' | 'gray'; }; const colorToClassName = { blue: { button: 'bg-blue-800 data-[hover]:bg-blue-700 data-[open]:bg-blue-700', dropdown: 'bg-blue-900', }, red: { button: 'bg-rose-800 data-[hover]:bg-rose-700 data-[open]:bg-rose-700', dropdown: 'bg-rose-900', }, gray: { button: 'bg-stone-400 data-[hover]:bg-stone-500 data-[open]:bg-stone-500', dropdown: 'bg-stone-600', }, }; const DropdownButton: React.FC = ({ items, title, placeholder, end, color = 'blue', }) => { const colorClassName = colorToClassName[color]; return (
{title}
{placeholder}
{items.map(item => ( {() => (
{item.hrEnabled ? (
) : null}
)}
))}
); }; export default DropdownButton;