import { Fragment, useEffect, useState } from "react"; import { classNames } from "@documenso/lib"; import { Listbox, Transition } from "@headlessui/react"; import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline"; const stc = require("string-to-color"); export default function RecipientSelector(props: any) { const [selectedRecipient, setSelectedRecipient]: any = useState(props?.recipients[0]); useEffect(() => { props.onChange(selectedRecipient); }, [selectedRecipient]); return ( { setSelectedRecipient(e); }}> {({ open }) => (
{`${selectedRecipient?.name} <${selectedRecipient?.email}>`} {props?.recipients.map((recipient: any) => ( classNames( active ? "bg-neon-dark text-white" : "text-gray-900", "relative cursor-default select-none py-2 pl-3 pr-9" ) } value={recipient}> {({ selected, active }) => ( <>
{`${recipient?.name} <${recipient?.email}>`}
{selected ? ( ) : null} )}
))}
)}
); }