import { FocusEvent, useState } from "react"; type EvoDropDownItem = { name: string, value: any } interface EvoDropDownProps { className?: string; name?: string; items: EvoDropDownItem[]; initItem?: EvoDropDownItem; onValueChange?: (item: EvoDropDownItem) => void; onBlur?: (e: FocusEvent) => void } interface MenuProps extends EvoDropDownProps { appear: boolean; } function Menu ({ className, items, initItem, appear, onValueChange, onBlur }: MenuProps) { const [currentItem, setItem] = useState(initItem || items[0]); return (
{items.map((item) => ( ))}
) } function EvoDropDown ({ className, name, items, initItem, onValueChange }: EvoDropDownProps) { const [appear, setAppear] = useState(false); const [currentItem, setItem] = useState(initItem || items[0]); const handleClick = () => { setAppear(!appear); } return (
{items.map((item) => ( ))}
) } EvoDropDown.Menu = Menu; export default EvoDropDown;