Use recoil for state management

This commit is contained in:
J Francisco Rader committed 2020-08-22 15:39:46 -03:00
1 parent 7a46eaf2be
commit d8f756b309
10 files changed
+63 -49

No files matched your search

-1
View File
@@ -1,5 +1,4 @@
import React from "react";
import { ClickAwayListener } from "@material-ui/core";
export const AppWrapper = ({ children, style, handleClickAway, ...props }) => {
return (
+21 -25
View File
@@ -1,13 +1,11 @@
import React from "react";
import {
Drawer,
ListItem,
List,
ListItemIcon,
ListItemText,
Slide,
makeStyles,
ClickAwayListener,
} from "@material-ui/core";
const useStyles = makeStyles((theme) => ({
@@ -15,33 +13,31 @@ const useStyles = makeStyles((theme) => ({
width: "100%",
backgroundColor: theme.palette.background.default,
color: "black",
zIndex: 2
zIndex: 2,
},
}));
export const ContextMenu = ({ open, onClose, handleClickAway, options }) => {
export const ContextMenu = ({ open, onClose, options }) => {
const classes = useStyles();
return (
<ClickAwayListener onClickAway={handleClickAway}>
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
<div className={classes.root}>
<List component="nav" aria-label="context menu">
{options.map((option) => (
<ListItem
button
key={option.key}
onClick={(e) => {
option.onClick(e, option);
onClose();
}}
>
<ListItemIcon>{option.icon}</ListItemIcon>
<ListItemText primary={option.label} />
</ListItem>
))}
</List>
</div>
</Slide>
</ClickAwayListener>
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
<div className={classes.root}>
<List component="nav" aria-label="context menu">
{options.map((option) => (
<ListItem
button
key={option.key}
onClick={(e) => {
option.onClick(e, option);
onClose();
}}
>
<ListItemIcon>{option.icon}</ListItemIcon>
<ListItemText primary={option.label} />
</ListItem>
))}
</List>
</div>
</Slide>
);
};