// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from "react"; import { Popover, List, ListItem, ListItemIcon, ListItemText, Divider } from "@material-ui/core"; import { DefaultTransformOrigin } from "../popover/helpers"; export interface ContextMenuAction { name: string; icon: string; } export type ContextMenuActionGroup = ContextMenuAction[]; export interface ContextMenuProps { anchorEl?: HTMLElement; actions: ContextMenuActionGroup[]; onActionClick: (action: ContextMenuAction) => void; onClose: () => void; } export default class ContextMenu extends React.PureComponent> { render() { const { anchorEl, actions, onClose, onActionClick } = this.props; return {actions.map((group, groupIndex) => {group.map((action, actionIndex) => onActionClick(action)}> {action.name} )} {groupIndex < actions.length - 1 && } )} ; } handleContextMenu = (event: React.MouseEvent) => { event.preventDefault(); this.props.onClose(); } }