import {isValidElement} from 'react'; import Divider from '@mui/material/Divider'; import Typography from '@mui/material/Typography'; import MenuItem from '@mui/material/MenuItem'; import {Icon, ListItemIcon, ListItemText} from '@mui/material'; export type ActionType = { divider?: boolean; label: JSX.Element | string; icon?: string; id: string; onClick?: () => void; }; interface Props { action: ActionType; } const Action = (props: Props): JSX.Element => { const {action} = props; const {divider, onClick, id, label, icon, ...menuItemProps} = action; if (divider) return ; else if (isValidElement(label)) return label; else if (onClick) return ( {icon} {label} ); else return ( {label} ); }; export default Action;