import { Fragment } from "react"; import { Listbox, Transition } from "@headlessui/react"; import { HiCheck as CheckIcon, HiSelector as SelectorIcon } from "react-icons/hi"; import clsx from "clsx"; type Option = { name: string; value: string }; type Props = { options: Option[]; onChange: (selectedValue: Option) => void; value: Option; }; export default function Select({ options, onChange, value }: Props) { return (
{value.name} {options.map((option, index) => ( clsx( "cursor-default select-none relative py-2 pl-10 pr-4", active ? "text-amber-900 bg-amber-100" : "text-gray-900", ) } value={option} > {({ selected, active }) => ( <> {option.name} {selected ? ( ) : null} )} ))}
); }