Skip to content

Commit f2012b9

Browse files
committed
options to have the menu button always visible
1 parent 22e0560 commit f2012b9

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/templates/AppBar/BasicAppBar/BasicAppBar.jsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Typography from 'material-ui/Typography';
88
import MenuIcon from 'material-ui-icons/Menu';
99
import Hidden from 'material-ui/Hidden';
1010
import { withStyles } from 'material-ui/styles';
11-
import withWidth from 'material-ui/utils/withWidth';
11+
import withWidth, { isWidthDown } from 'material-ui/utils/withWidth';
1212
import compose from 'recompose/compose';
1313

1414
import styles from './styles';
@@ -20,11 +20,17 @@ class BasicAppBar extends React.PureComponent {
2020
title: PropTypes.string,
2121
logo: PropTypes.string,
2222
onIconClick: PropTypes.func,
23+
menuIconAlways: PropTypes.bool,
24+
width: PropTypes.string,
25+
};
26+
27+
static defaultProps = {
28+
menuIconAlways: false,
2329
};
2430

2531
handleIconClick = () => {
2632
this.props.onIconClick();
27-
}
33+
};
2834

2935
renderLogo = () => {
3036
const { classes, title, logo } = this.props;
@@ -43,14 +49,18 @@ class BasicAppBar extends React.PureComponent {
4349
};
4450

4551
render() {
46-
const { links } = this.props;
52+
const { links, menuIconAlways, width } = this.props;
4753
return (
4854
<Toolbar>
49-
<Hidden smUp>
50-
<IconButton color="inherit" aria-label="Menu" onClick={this.handleIconClick}>
55+
{menuIconAlways || isWidthDown('xs', width) ? (
56+
<IconButton
57+
color="inherit"
58+
aria-label="Menu"
59+
onClick={this.handleIconClick}
60+
>
5161
<MenuIcon />
5262
</IconButton>
53-
</Hidden>
63+
) : null}
5464
{this.renderLogo()}
5565
<Hidden xsDown>
5666
<div>

0 commit comments

Comments
 (0)