import { useState } from 'react'; import Arrow2 from '../assets/dropdown-arrow.svg'; function Dropdown({ options, selectedValue, onSelect, showDelete, onDelete, }: { options: | string[] | { name: string; id: string; type: string }[] | { label: string; value: string }[]; selectedValue: string | { label: string; value: string }; onSelect: | ((value: string) => void) | ((value: { name: string; id: string; type: string }) => void) | ((value: { label: string; value: string }) => void); showDelete?: boolean; onDelete?: (value: string) => void; }) { const [isOpen, setIsOpen] = useState(false); return (
{isOpen && (
{options.map((option: any, index) => (
{ onSelect(option); setIsOpen(false); }} className="ml-2 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap py-3 dark:text-light-gray" > {typeof option === 'string' ? option : option.name ? option.name : option.label} {showDelete && onDelete && ( )}
))}
)}
); } export default Dropdown;