Debian Codegraph @

web/src/components/PopupMenu.jsx

raw
1 import { Fade, Menu } from "@mui/material";
2 import * as React from "react";
3
4 const PopupMenu = (props) => {
5 const horizontal = props.horizontal ?? "left";
6 const arrow = horizontal === "right" ? { right: 19 } : { left: 19 };
7 return (
8 <Menu
9 anchorEl={props.anchorEl}
10 open={props.open}
11 onClose={props.onClose}
12 onClick={props.onClose}
13 slots={{ transition: Fade }}
14 slotProps={{
15 paper: {
16 elevation: 0,
17 sx: {
18 overflow: "visible",
19 filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
20 mt: 1.5,
21 "& .MuiAvatar-root": {
22 width: 32,
23 height: 32,
24 ml: -0.5,
25 mr: 1,
26 },
27 "&:before": {
28 content: '""',
29 display: "block",
30 position: "absolute",
31 top: 0,
32 width: 10,
33 height: 10,
34 bgcolor: "background.paper",
35 transform: "translateY(-50%) rotate(45deg)",
36 zIndex: 0,
37 ...arrow,
38 },
39 },
40 },
41 }}
42 transformOrigin={{ horizontal, vertical: "top" }}
43 anchorOrigin={{ horizontal, vertical: "bottom" }}
44 >
45 {props.children}
46 </Menu>
47 );
48 };
49
50 export default PopupMenu;