Skip to content

Commit

Permalink
feat(drawerMenu): make menu swipeable, move icon to right, add divider
Browse files Browse the repository at this point in the history
  • Loading branch information
Clm-Roig committed Mar 19, 2022
1 parent d95de4c commit 9d6e5f9
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/app/DrawerMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { FC } from 'react';
import { Link } from 'react-router-dom';
import { Drawer, IconButton, List, ListItem, ListItemIcon, ListItemText } from '@mui/material';
import {
Box,
Divider,
IconButton,
List,
ListItem,
ListItemIcon,
ListItemText,
SwipeableDrawer
} from '@mui/material';
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
import ListAltIcon from '@mui/icons-material/ListAlt';
import TimelineIcon from '@mui/icons-material/Timeline';
Expand All @@ -13,21 +22,25 @@ interface Props {

const DrawerMenu: FC<Props> = ({ open, toggleDrawerMenu, width }) => {
return (
<Drawer
<SwipeableDrawer
anchor="left"
onClose={toggleDrawerMenu}
onOpen={toggleDrawerMenu}
open={open}
sx={{
width: width,
flexShrink: 0,
'& .MuiDrawer-paper': {
width: width,
boxSizing: 'border-box'
}
}}
variant="persistent"
anchor="left"
open={open}>
<IconButton onClick={toggleDrawerMenu}>
<ChevronLeftIcon />
</IconButton>
}}>
<Box sx={{ display: 'flex', justifyContent: 'right' }}>
<IconButton onClick={toggleDrawerMenu}>
<ChevronLeftIcon />
</IconButton>
</Box>
<Divider />
<List>
<ListItem component={Link} to="/trackers" button key={'Mes Trackers'}>
<ListItemIcon>
Expand All @@ -42,7 +55,7 @@ const DrawerMenu: FC<Props> = ({ open, toggleDrawerMenu, width }) => {
<ListItemText primary={'Statistiques'} />
</ListItem>
</List>
</Drawer>
</SwipeableDrawer>
);
};

Expand Down

0 comments on commit 9d6e5f9

Please sign in to comment.