import { useState } from "react"; import { IOption } from "../types/selectorOption"; import ChevronDownIcon from "./icons/ChevronDownIcon"; import CheckIcon from "./icons/CheckIcon"; import { useClickAway } from "@uidotdev/usehooks"; interface TransparentSelectorProps { options: IOption[]; onClick: (optId: string) => void; } const TransparentSelector = ({ options, onClick, }: TransparentSelectorProps) => { const [isOpened, setIsOpened] = useState(false); const selectedOpt = options.find((opt) => opt.isSelected)?.value; const selectorRef = useClickAway(() => { setIsOpened(false); }) as React.LegacyRef | undefined; const handleOnClick = () => { setIsOpened((prev) => !prev); }; return (
{selectedOpt &&

{selectedOpt} floor

}
{isOpened && options.length !== 0 && (
{options.map((opt) => (
onClick(opt.id)} className="px-[28.8px] py-[19.2px] text-[33.6px] flex gap-[19.2px]" > {opt.isSelected && (
)}

{opt.value} floor

))}
)}
); }; export default TransparentSelector;