From 219019a3bd8a744a2cbf9dd16285a9ebfa5709cd Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Sat, 15 May 2021 18:47:16 +0530 Subject: Report Filter Design --- modern/src/reports/ReportLayoutPage.js | 139 +++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 58 deletions(-) (limited to 'modern/src/reports/ReportLayoutPage.js') diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index cdce2b3c..ae7b3daf 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -19,12 +19,17 @@ const useStyles = makeStyles(theme => ({ height: '100%', display: 'flex', }, + drawer: { + width: 360, + [theme.breakpoints.down("md")]: { + width: 0, + } + }, content: { flex: 1, - overflow: 'auto', - padding: theme.spacing(2), + padding: theme.spacing(3), }, - drawer: { + drawerPaper: { width: 360, [theme.breakpoints.down("md")]: { width: 320, @@ -36,6 +41,11 @@ const useStyles = makeStyles(theme => ({ alignItems: 'center', padding: theme.spacing(0, 1), }, + toolbar: { + [theme.breakpoints.down("md")]: { + ...theme.mixins.toolbar, + } + }, form: { padding: theme.spacing(1, 2, 2), }, @@ -47,7 +57,6 @@ const ReportLayoutPage = ({ children, filter }) => { const theme = useTheme(); const matchesMD = useMediaQuery(theme.breakpoints.down("md")); const [openDrawer, setOpenDrawer] = useState(false); - const [value, setValue] = useState(0); const routes = [ { name: t('reportRoute'), link: '/reports/route', icon: , activeIndex: 0 }, @@ -58,64 +67,78 @@ const ReportLayoutPage = ({ children, filter }) => { { name: t('reportChart'), link: '/reports/chart', icon: , activeIndex: 5 }, ]; - const handleClick = (route) => { + const navigationList = ( + + {routes.map(route => ( + handleListItemClick(route)} + > + + {route.icon} + + + + ))} + + ); + + const drawerHeader = ( + <> +
+ + + + + Reports + +
+ + + ); + + const appBar = ( + + + setOpenDrawer(!openDrawer)} + className={classes.menuButton} + > + + + + Reports + + + + ); + + const handleListItemClick = (route) => { history.push(route.link); } - console.log('rendering Layout, ', value); + return (
- {matchesMD && - - setOpenDrawer(!openDrawer)} - className={classes.menuButton} - > - - - - Reports - - - - } - setOpenDrawer(!openDrawer)} - classes={{ paper: classes.drawer }} - > - { !matchesMD && - <> -
- - - - - Reports - -
- - - } - - {routes.map(route => ( - { setValue(route.activeIndex); handleClick(route)}} - > - - {route.icon} - - - - ))} - -
+ { matchesMD && appBar } + +
+
+ {filter} +
); } -- cgit v1.2.3