aboutsummaryrefslogtreecommitdiff
path: root/modern/src/components/reports/ReportSidebar.js
blob: e42c36ee5a4318cb14f45e4b2944593302173ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react';
import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, IconButton, Hidden } from '@material-ui/core';
import { Link, useHistory, useLocation } from 'react-router-dom';

const ReportNavbar = ({ routes, setReportName }) => {

  const location = useLocation();

  return (
    <List disablePadding>
      {routes.map((route, index) => (
        <ListItem
          disableRipple
          component={Link}
          key={`${route}${index}`}
          button
          to={route.href}
          selected={route.href === location.pathname}
          onClick={() =>  setReportName(route.name)}>
          <ListItemIcon>
            {route.icon}
          </ListItemIcon>
          <ListItemText primary={route.name} />
        </ListItem>
      ))}
    </List>
  )
}

export default ReportNavbar;