// react-hook-form import { Control, Controller } from "react-hook-form"; // hooks import useUser from "lib/hooks/useUser"; // headless ui import { Listbox, Transition } from "@headlessui/react"; // types import { IIssue } from "types"; import { classNames } from "constants/common"; import { Spinner } from "ui"; import React from "react"; import { ChevronDownIcon, Squares2X2Icon } from "@heroicons/react/24/outline"; type Props = { control: Control; submitChanges: (formData: Partial) => void; }; const SelectState: React.FC = ({ control, submitChanges }) => { const { states } = useUser(); return (

State

( { submitChanges({ state: value }); }} className="flex-shrink-0" > {({ open }) => (
{value ? ( <> option.id === value)?.color, }} > {states?.find((option) => option.id === value)?.name} ) : ( "None" )}
{states ? ( states.length > 0 ? ( states.map((option) => ( `${ active || selected ? "text-white bg-theme" : "text-gray-900" } flex items-center gap-2 cursor-pointer select-none relative p-2 rounded-md truncate` } value={option.id} > {option.color && ( )} {option.name} )) ) : (
No states found
) ) : ( )}
)}
)} />
); }; export default SelectState;