You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wg-access-server/website/src/components/IconMenu.tsx

38 lines
923 B
TypeScript

import React from 'react';
import IconButton from '@material-ui/core/IconButton';
import MoreVertIcon from '@material-ui/icons/MoreVert';
import Menu from '@material-ui/core/Menu';
interface Props {
children: React.ReactNode;
}
export function IconMenu(props: Props) {
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
return (
<div>
<IconButton aria-controls="icon-menu" aria-haspopup="true" onClick={handleClick}>
<MoreVertIcon />
</IconButton>
<Menu
id="icon-menu"
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}
>
<div onClick={handleClose}>{props.children}</div>
</Menu>
</div>
);
}