From 36d05b64fbcd52760e023af227748b2efd74d21f Mon Sep 17 00:00:00 2001 From: Desmond Kyeremeh Date: Thu, 1 Jul 2021 13:53:44 +0000 Subject: Abstract ReportSidebar into SideNav component --- modern/src/components/SideNav.js | 41 ++++++++++++++++++++++++++ modern/src/components/reports/ReportSidebar.js | 29 ------------------ 2 files changed, 41 insertions(+), 29 deletions(-) create mode 100644 modern/src/components/SideNav.js delete mode 100644 modern/src/components/reports/ReportSidebar.js (limited to 'modern/src/components') diff --git a/modern/src/components/SideNav.js b/modern/src/components/SideNav.js new file mode 100644 index 0000000..669c79a --- /dev/null +++ b/modern/src/components/SideNav.js @@ -0,0 +1,41 @@ +import React from 'react'; +import { + List, + ListItem, + ListItemText, + ListItemIcon, + Divider, + ListSubheader +} from '@material-ui/core'; +import { Link, useLocation } from 'react-router-dom'; + +const SideNav = ({ routes }) => { + const location = useLocation(); + + return ( + + {routes.map((route, index) => + route.subheader ? ( + <> + + {route.subheader} + + ) : ( + + {route.icon} + + + ) + )} + + ); +}; + +export default SideNav; diff --git a/modern/src/components/reports/ReportSidebar.js b/modern/src/components/reports/ReportSidebar.js deleted file mode 100644 index 90e20c0..0000000 --- a/modern/src/components/reports/ReportSidebar.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import { List, ListItem, ListItemText, ListItemIcon } from '@material-ui/core'; -import { Link, useLocation } from 'react-router-dom'; - -const ReportSidebar = ({ routes }) => { - - const location = useLocation(); - - return ( - - {routes.map((route, index) => ( - - - {route.icon} - - - - ))} - - ) -} - -export default ReportSidebar; -- cgit v1.2.3