import { Listbox } from '@headlessui/react' import { ChevronDownIcon } from '@heroicons/react/20/solid' import { ReactNode } from 'react' interface SelectProps { value: string | ReactNode onChange: (x: string) => void children: ReactNode className?: string dropdownPanelClassName?: string placeholder?: string disabled?: boolean } const Select = ({ value, onChange, children, className, dropdownPanelClassName, placeholder = 'Select', disabled = false, }: SelectProps) => { return (
{({ open }) => ( <>
{value ? ( value ) : ( {placeholder} )}
{open ? ( {children} ) : null} )}
) } interface OptionProps { value: string children: string | ReactNode className?: string } const Option = ({ value, children, className }: OptionProps) => { return ( {({ selected }) => (
{children}
)}
) } Select.Option = Option export default Select