import React from 'react'; import { ListItemIcon, ListItemText, Slide, makeStyles, Paper, } from '@material-ui/core'; import { List } from './List'; import { ListItem } from './ListItem'; import { useTranslation } from 'react-i18next'; const useStyles = makeStyles((theme) => ({ root: { borderTop: '1px solid', borderColor: theme.palette.primary.main, width: '100%', position: 'absolute', bottom: 0, zIndex: 2, }, })); interface IContextMenuOption { onClick(e, option): void; label: string; description?: string; selected?: boolean; icon?: React.ReactNode; key?: string; }; interface IContextMenuProps { open: boolean; onClose(): void; options: Array; } export const ContextMenu = ({ open, onClose, options }: IContextMenuProps) => { const classes = useStyles(); const { t } = useTranslation(); const _options = onClose ? [ ...options, { label: t('GENERIC_CLOSE'), onClick: onClose, } as IContextMenuOption, ] : options; return ( {_options.map((option) => ( { option.onClick(e, option); onClose(); }} > {option.icon && {option.icon}} ))} ); };