import { IconButton, Menu, MenuItem, PaperProps, Tooltip } from "@granity/ui"; import { FC, useState } from "react"; export type CommonMenuList = { text: string; onClick: () => void; icon: any; }; type Props = { title: string; id: string; icon: any; // TODO menuItems: CommonMenuList[]; }; type CommonMenuStyles = { menuPaper?: PaperProps; }; const styles: CommonMenuStyles = { menuPaper: { sx: { overflow: "visible", filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))", mt: 1.5, "& .MuiAvatar-root": { width: 32, height: 32, ml: -0.5, mr: 1, }, "&:before": { content: '""', display: "block", position: "absolute", top: 0, right: 14, width: 10, height: 10, bgcolor: "background.paper", transform: "translateY(-50%) rotate(45deg)", zIndex: 0, }, }, }, }; const CommonMenu: FC = ({ title, id, icon, menuItems }) => { const IconTrigger = icon; const [anchorEl, setAnchorEl] = useState(null); const open = Boolean(anchorEl); const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; return ( <> {menuItems.map((x) => ( {x.icon} {x.text} ))} ); }; export default CommonMenu;