// 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; onClick: (item: T) => void; } export type ContextMenuActionGroup = Array>; export interface ContextMenuProps { anchorEl?: HTMLElement; item?: T; onClose: () => void; actions: Array>; } export default class ContextMenu extends React.PureComponent> { render() { const { anchorEl, onClose, actions, item } = this.props; return {actions.map((group, groupIndex) => {group.map((action, actionIndex) => item && action.onClick(item)}> {action.name} )} {groupIndex < actions.length - 1 && } )} ; } }