diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-05-22 12:49:22 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-05-22 12:49:22 +0530 |
commit | f15034e5fe4e5c702975b8a0f583a9917c4b1b3b (patch) | |
tree | ee820cd9d53cd296b916996e3e2d748575168f60 /modern/src/reports/ReportLayoutPage.js | |
parent | 0ab07c40f48889727b1503eaedb5daa8f344dd19 (diff) | |
download | trackermap-web-f15034e5fe4e5c702975b8a0f583a9917c4b1b3b.tar.gz trackermap-web-f15034e5fe4e5c702975b8a0f583a9917c4b1b3b.tar.bz2 trackermap-web-f15034e5fe4e5c702975b8a0f583a9917c4b1b3b.zip |
Resolving Comments and Observations
Diffstat (limited to 'modern/src/reports/ReportLayoutPage.js')
-rw-r--r-- | modern/src/reports/ReportLayoutPage.js | 87 |
1 files changed, 23 insertions, 64 deletions
diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index 4ffc8816..fbb8a303 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -10,6 +10,9 @@ import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; import TrendingUpIcon from '@material-ui/icons/TrendingUp'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; +import ReportSidebar from '../components/reports/ReportSidebar' +import ReportNavbar from '../components/reports/ReportNavbar' + import { Link, useHistory, useLocation } from 'react-router-dom'; import t from '../common/localization'; @@ -20,10 +23,10 @@ const useStyles = makeStyles(theme => ({ height: '100%', }, drawerContainer: { - width: theme.dimensions.drawerWidth, + width: theme.dimensions.desktopDrawerWidth, }, drawer: { - width: theme.dimensions.drawerWidth, + width: theme.dimensions.desktopDrawerWidth, [theme.breakpoints.down("md")]: { width: theme.dimensions.tabletDrawerWidth, } @@ -62,89 +65,45 @@ const routes = [ const ReportLayoutPage = ({ children, filter }) => { const classes = useStyles(); const history = useHistory(); - const theme = useTheme(); const [openDrawer, setOpenDrawer] = useState(false); - const location = useLocation(); - - const navigationList = ( - <List disablePadding> - {routes.map((route, index) => ( - <ListItem - disableRipple - component={Link} - key={`${route}${index}`} - button - to={route.href} - selected={route.href === location.pathname}> - <ListItemIcon> - {route.icon} - </ListItemIcon> - <ListItemText primary={route.name} /> - </ListItem> - ))} - </List> - ); - - const drawerHeader = ( - <> - <div className={classes.drawerHeader}> - <IconButton - className={classes.backArrowIconContainer} - disableRipple> - <ArrowBackIcon /> - </IconButton> - <Typography variant="h6" color="inherit" noWrap> - {t('reportTitle')} - </Typography> - </div> - <Divider /> - </> - ); - - const appBar = ( - <AppBar position="fixed" color="inherit"> - <Toolbar> - <IconButton - color="inherit" - aria-label="open drawer" - edge="start" - onClick={() => setOpenDrawer(!openDrawer)} - className={classes.menuButton}> - <MenuIcon /> - </IconButton> - <Typography variant="h6" noWrap> - {t('reportTitle')} - </Typography> - </Toolbar> - </AppBar> - ); return ( <div className={classes.root}> - <Hidden mdUp> - {appBar} + <Hidden only={['lg', 'xl']}> + <ReportNavbar openDrawer={openDrawer} setOpenDrawer={setOpenDrawer} /> <Drawer variant="temporary" open={openDrawer} onClose={() => setOpenDrawer(!openDrawer)} classes={{paper: classes.drawer}}> - {drawerHeader} - {navigationList} + <ReportSidebar routes={routes} /> </Drawer> </Hidden> - <Hidden mdDown> + <Hidden only={['xs', 'sm', 'md']}> <div className={classes.drawerContainer}> <Drawer variant="permanent" classes={{paper: classes.drawer}}> - {drawerHeader} - {navigationList} + <div className={classes.drawerHeader}> + <IconButton + onClick={() => history.push('/')} + className={classes.backArrowIconContainer} + disableRipple> + <ArrowBackIcon /> + </IconButton> + <Typography variant="h6" color="inherit" noWrap> + {t('reportTitle')} + </Typography> + </div> + <Divider /> + <ReportSidebar routes={routes} /> </Drawer> </div> </Hidden> <div className={classes.content}> <div className={classes.toolbar} /> {filter} + {children} </div> </div> ); |