Skip to content

Commit b3673fb

Browse files
committed
Added TwoRowsAppBar
1 parent c3c6ac2 commit b3673fb

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import React, { PureComponent } from 'react';
2+
import PropTypes from 'prop-types';
3+
import Toolbar from 'material-ui/Toolbar';
4+
import Grid from 'material-ui/Grid';
5+
import { withStyles } from 'material-ui/styles';
6+
7+
import styles from './styles';
8+
9+
class TwoRowsAppBar extends PureComponent {
10+
static propTypes = {
11+
classes: PropTypes.shape({}),
12+
topLeftContent: PropTypes.oneOf(PropTypes.element, PropTypes.arrayOf(PropTypes.element)),
13+
topCenterContent: PropTypes.oneOf(PropTypes.element, PropTypes.arrayOf(PropTypes.element)),
14+
topRightContent: PropTypes.oneOf(PropTypes.element, PropTypes.arrayOf(PropTypes.element)),
15+
bottomLeftContent: PropTypes.oneOf(PropTypes.element, PropTypes.arrayOf(PropTypes.element)),
16+
bottomCenterContent: PropTypes.oneOf(PropTypes.element, PropTypes.arrayOf(PropTypes.element)),
17+
bottomRightContent: PropTypes.oneOf(PropTypes.element, PropTypes.arrayOf(PropTypes.element)),
18+
};
19+
20+
static defaultProps = {
21+
classes: {},
22+
topLeftContent: null,
23+
topCenterContent: null,
24+
topRightContent: null,
25+
bottomLeftContent: null,
26+
bottomCenterContent: null,
27+
bottomRightContent: null,
28+
}
29+
30+
render() {
31+
const {
32+
classes,
33+
topLeftContent,
34+
topCenterContent,
35+
topRightContent,
36+
bottomLeftContent,
37+
bottomCenterContent,
38+
bottomRightContent,
39+
} = this.props;
40+
return (
41+
<Toolbar>
42+
<Grid container direction="column" className={classes.wrapper}>
43+
<Grid container className={classes.topRow} justify={'space-between'}>
44+
<Grid item xs={2} className={classes.left}>
45+
{topLeftContent}
46+
</Grid>
47+
<Grid item xs={8} className={classes.topCenter}>
48+
{topCenterContent}
49+
</Grid>
50+
<Grid item xs={2} className={classes.right}>
51+
{topRightContent}
52+
</Grid>
53+
</Grid>
54+
<Grid container className={classes.bottomRow} justify={'space-between'}>
55+
<Grid item xs={2} className={classes.left}>
56+
{bottomLeftContent}
57+
</Grid>
58+
<Grid item xs={8} className={classes.bottomCenter}>
59+
{bottomCenterContent}
60+
</Grid>
61+
<Grid item xs={2} className={classes.right}>
62+
{bottomRightContent}
63+
</Grid>
64+
</Grid>
65+
</Grid>
66+
</Toolbar>
67+
);
68+
}
69+
}
70+
71+
export default withStyles(styles)(TwoRowsAppBar);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import TwoRowsAppBar from './TwoRowsAppBar';
2+
3+
export default TwoRowsAppBar;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export default {
2+
wrapper: {
3+
marginTop: '0',
4+
marginBottom: '0',
5+
},
6+
topRow: {
7+
height: '64px',
8+
marginTop: '0',
9+
marginBottom: '0',
10+
},
11+
bottomRow: {
12+
height: '56px',
13+
marginTop: '0',
14+
marginBottom: '0',
15+
},
16+
topCenter:{
17+
textAlign: 'center',
18+
display: 'flex',
19+
justifyContent: 'center',
20+
alignItems: 'center',
21+
},
22+
bottomCenter:{
23+
textAlign: 'center',
24+
display: 'flex',
25+
justifyContent: 'center',
26+
alignItems: 'center',
27+
},
28+
right:{
29+
justifyContent: 'flex-end',
30+
display: 'flex',
31+
},
32+
left:{
33+
justifyContent: 'flex-start',
34+
display: 'flex',
35+
}
36+
};

0 commit comments

Comments
 (0)