import { Listbox, Transition } from '@headlessui/react'; import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid'; import { Fragment } from 'react'; export interface SelectorProps { children: JSX.Element; className?: string; items: { label: string; value: string; data?: T }[]; selected: { label: string; value: string }; onChange: (item: { label: string; value: string; data?: T }) => void; } export function Selector(props: SelectorProps): JSX.Element { return (
props.onChange(selection)} > {({ open }) => ( <>
{props.children} {props.selected.label} {props.items.map((item, personIdx) => ( `relative list-none cursor-pointer hover:bg-slate-50 dark:hover:bg-slate-800 select-none py-2 px-3` } value={item} > {({ selected, active }) => ( <> {item.label} )} ))}
)}
); }