From 15db54a9e1ade16758eb0f716e7eb72c9847109a Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Sat, 15 May 2021 15:51:09 +0530 Subject: Adding ReportHeader --- modern/src/reports/ReportHeader.js | 0 modern/src/reports/ReportLayoutPage.js | 38 +++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 modern/src/reports/ReportHeader.js (limited to 'modern/src') diff --git a/modern/src/reports/ReportHeader.js b/modern/src/reports/ReportHeader.js new file mode 100644 index 0000000..e69de29 diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index c5e13fd..cdce2b3 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -8,9 +8,9 @@ import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled'; import NotificationsActiveIcon from '@material-ui/icons/NotificationsActive'; import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted'; import TrendingUpIcon from '@material-ui/icons/TrendingUp'; -import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; +import ArrowBackIcon from '@material-ui/icons/ArrowBack'; -import { Link } from "react-router-dom"; +import { useHistory } from 'react-router-dom'; import t from '../common/localization'; @@ -43,9 +43,11 @@ const useStyles = makeStyles(theme => ({ const ReportLayoutPage = ({ children, filter }) => { const classes = useStyles(); + const history = useHistory(); 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 }, @@ -56,6 +58,10 @@ const ReportLayoutPage = ({ children, filter }) => { { name: t('reportChart'), link: '/reports/chart', icon: , activeIndex: 5 }, ]; + const handleClick = (route) => { + history.push(route.link); + } + console.log('rendering Layout, ', value); return (
{matchesMD && @@ -81,27 +87,31 @@ const ReportLayoutPage = ({ children, filter }) => { onClose={() => setOpenDrawer(!openDrawer)} classes={{ paper: classes.drawer }} > -
- - - -
- + { !matchesMD && + <> +
+ + + + + Reports + +
+ + + } {routes.map(route => ( setOpenDrawer(false)} + selected={value === route.activeIndex} + onClick={() => { setValue(route.activeIndex); handleClick(route)}} > {route.icon} - - {route.name} - + ))} -- cgit v1.2.3