app/src/containers/EventMenu/index.js (view raw)
1import React from "react";
2import Menu from "@material-ui/core/Menu";
3import MenuItem from "@material-ui/core/MenuItem";
4
5const EventMenu = ({ anchorEl, setAnchorEl, actions = [] }) => {
6 return (
7 <Menu
8 anchorEl={anchorEl}
9 anchorOrigin={{
10 vertical: "top",
11 horizontal: "right",
12 }}
13 keepMounted
14 transformOrigin={{
15 vertical: "top",
16 horizontal: "right",
17 }}
18 open={!!anchorEl}
19 onClose={() => setAnchorEl(null)}
20 >
21 {actions &&
22 actions.map((action, idx) => (
23 <MenuItem
24 onClick={() => {
25 action.onClick();
26 setAnchorEl(null);
27 }}
28 key={idx}
29 >
30 {action.label}
31 </MenuItem>
32 ))}
33 </Menu>
34 );
35};
36
37export default EventMenu;