Skip to content

Commit 4d4d656

Browse files
authored
Merge branch 'develop' into fix/fixing-previous-version
2 parents c5cb994 + 7dcd187 commit 4d4d656

File tree

7 files changed

+94
-1
lines changed

7 files changed

+94
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "material-ui-layout",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"description": "Layout components for material-ui",
55
"main": "./lib/index.js",
66
"scripts": {

src/components/AppBar/AppBar.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
55
import { withStyles } from 'material-ui/styles';
66
import MaterialUIAppBar from 'material-ui/AppBar';
77

8+
89
import styles from './styles';
910

1011
class AppBar extends React.PureComponent {

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Layout from './components/Layout';
33
export { default as AppBar } from './components/AppBar';
44
export { default as Footer } from './components/Footer';
55

6+
67
export { default as BasicAppBar } from './templates/AppBar/BasicAppBar';
78
export { default as TwoRowsAppBar } from './templates/AppBar/TwoRowsAppBar';
89
export { default as BasicFooter } from './templates/Footer/BasicFooter';
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import _ from 'lodash';
2+
import React from 'react';
3+
import PropTypes from 'prop-types';
4+
import IconButton from 'material-ui/IconButton';
5+
import Button from 'material-ui/Button';
6+
import Toolbar from 'material-ui/Toolbar';
7+
import Typography from 'material-ui/Typography';
8+
import MenuIcon from 'material-ui-icons/Menu';
9+
import Hidden from 'material-ui/Hidden';
10+
import { withStyles } from 'material-ui/styles';
11+
import withWidth from 'material-ui/utils/withWidth';
12+
import compose from 'recompose/compose';
13+
14+
import styles from './styles';
15+
16+
class BasicNavBar extends React.PureComponent {
17+
static propTypes = {
18+
links: PropTypes.arrayOf(PropTypes.shape({})),
19+
classes: PropTypes.shape({}),
20+
title: PropTypes.string,
21+
logo: PropTypes.string,
22+
onIconClick: PropTypes.func,
23+
};
24+
25+
handleIconClick = () => {
26+
this.props.onIconClick();
27+
}
28+
29+
renderLogo = () => {
30+
const { classes, title, logo } = this.props;
31+
if (logo) {
32+
return (
33+
<div className={classes.logo}>
34+
<img src={logo} alt={title} className={classes.image} />
35+
</div>
36+
);
37+
}
38+
return (
39+
<Typography type="title" color="inherit" className={classes.flex}>
40+
{title}
41+
</Typography>
42+
);
43+
};
44+
45+
render() {
46+
const { links } = this.props;
47+
return (
48+
<Toolbar>
49+
<Hidden smUp>
50+
<IconButton color="inherit" aria-label="Menu" onClick={this.handleIconClick}>
51+
<MenuIcon />
52+
</IconButton>
53+
</Hidden>
54+
{this.renderLogo()}
55+
<Hidden xsDown>
56+
<div>
57+
{_.map(links, link => (
58+
<Button href={link.href} color="inherit" key={link.label}>
59+
{link.label}
60+
</Button>
61+
))}
62+
</div>
63+
</Hidden>
64+
</Toolbar>
65+
);
66+
}
67+
}
68+
69+
export default compose(withStyles(styles), withWidth())(BasicNavBar);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import BasicNavBar from './BasicNavBar';
2+
3+
export default BasicNavBar;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const styles = {
2+
flex: {
3+
flex: 1,
4+
},
5+
logo: {
6+
flex: 1,
7+
cursor: 'pointer',
8+
height: '45px',
9+
minWidth: '160px',
10+
},
11+
image: {
12+
height: '100%',
13+
margin: '0',
14+
padding: '0',
15+
},
16+
};
17+
18+
export default styles;

src/templates/AppBar/TwoRowsAppBar/TwoRowsAppBar.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class TwoRowsAppBar extends PureComponent {
2929
bottomRightContent: null,
3030
};
3131

32+
3233
render() {
3334
const {
3435
classes,

0 commit comments

Comments
 (0)