'use client'; import { useRef, useState } from 'react'; import { motion } from 'framer-motion'; import { v4 } from 'uuid'; import { BiSolidDownArrow } from 'react-icons/bi'; import { useOnClickOutside } from 'usehooks-ts'; interface ICustomSelect { name: string; label?: string; placeholder?: string; required?: boolean; items: string[]; isBlack?: boolean; setValue: (newValue: string) => void; } const CustomSelect = ({ name, label, placeholder, required, items, setValue, isBlack, }: ICustomSelect) => { const [open, setOpen] = useState(false); const ref = useRef(null); const [input, setInput] = useState(); useOnClickOutside(ref, () => setOpen(false)); return (
setOpen(!open)}> {label ? ( ) : null} {items.map((item) => ( { setValue(item); setInput(item); }} key={v4()}> {item} ))}
); }; export default CustomSelect;