blob: ea2f59718703a1bc90e2b6771cf51cc29f268e48 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { NavLink } from 'react-router-dom';
import OtherMenuContent from 'ba-api/otherMenu';
import { ListItem, ListItemText } from '@material-ui/core';
import styles from './sidebar-jss';
const LinkBtn = React.forwardRef(function LinkBtn(props, ref) { // eslint-disable-line
return <NavLink to={props.to} {...props} innerRef={ref} />; // eslint-disable-line
});
function OtherMenu(props) {
const { toggleDrawerOpen, classes } = props;
const getOtherMenu = menuArray => menuArray.map((item, index) => {
const keyIndex = index.toString();
return (
<div key={keyIndex}>
<ListItem
button
component={LinkBtn}
to={item.link}
activeClassName={classes.active}
onClick={toggleDrawerOpen}
>
<ListItemText secondary={item.name} />
</ListItem>
</div>
);
});
return (
<div>
{getOtherMenu(OtherMenuContent)}
</div>
);
}
OtherMenu.propTypes = {
classes: PropTypes.object.isRequired,
toggleDrawerOpen: PropTypes.func.isRequired,
};
export default withStyles(styles)(OtherMenu);
|