1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import Menu from "@mui/material/Menu";
7 import IconButton from "@mui/material/IconButton";
8 import { PopoverOrigin } from "@mui/material/Popover";
9 import { Tooltip } from "@mui/material";
11 interface DropdownMenuProps {
13 icon: React.ReactElement<any>;
17 interface DropdownMenuState {
21 export class DropdownMenu extends React.Component<DropdownMenuProps, DropdownMenuState> {
26 transformOrigin: PopoverOrigin = {
32 const { icon, id, children, title } = this.props;
33 const { anchorEl } = this.state;
40 aria-owns={anchorEl ? id : undefined}
43 onClick={this.handleOpen}
51 open={Boolean(anchorEl)}
52 onClose={this.handleClose}
53 onClick={this.handleClose}
54 transformOrigin={this.transformOrigin}>
62 this.setState({ anchorEl: undefined });
65 handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
66 this.setState({ anchorEl: event.currentTarget });