import { CSSProperties, MouseEventHandler, ReactNode, useState, VFC, } from 'react'; import { Menu } from '@mui/material'; import { ArrowDropDown } from '@mui/icons-material'; import { DropdownButton } from './DropdownButton/DropdownButton'; export interface IDropdownMenuProps { renderOptions: () => ReactNode; id: string; title?: string; callback?: MouseEventHandler; icon?: ReactNode; label: string; startIcon?: ReactNode; style?: CSSProperties; } const DropdownMenu: VFC = ({ renderOptions, id, title, callback, icon = , label, style, startIcon, ...rest }) => { const [anchor, setAnchor] = useState(null); const handleOpen: MouseEventHandler = e => { setAnchor(e.currentTarget); }; const handleClose: MouseEventHandler = e => { if (callback && typeof callback === 'function') { callback(e); } setAnchor(null); }; return ( <> {renderOptions()} ); }; export default DropdownMenu;