Skip to content

Commit 0569fe7

Browse files
committed
adapted the layout for a two row AppBar
1 parent 735ad60 commit 0569fe7

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

src/components/Layout/Layout.jsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class Layout extends React.PureComponent {
2121
overrideClasses: PropTypes.shape({}),
2222
children: PropTypes.element.isRequired,
2323
appBarPosition: PropTypes.string,
24-
stickyFooter: PropTypes.bool,
2524
appBarContent: PropTypes.element,
2625
appBarProps: PropTypes.shape({}),
26+
mainGrow: PropTypes.bool,
27+
stickyFooter: PropTypes.bool,
2728
footerContent: PropTypes.element,
2829
footerProps: PropTypes.shape({}),
2930
leftDrawerOpen: PropTypes.bool.isRequired,
@@ -39,6 +40,7 @@ class Layout extends React.PureComponent {
3940
rightDrawerUnder: PropTypes.bool,
4041
rightDrawerProps: PropTypes.shape({}),
4142
width: PropTypes.string,
43+
usingTwoRowAppBar: PropTypes.bool,
4244
};
4345

4446
static defaultProps = {
@@ -49,6 +51,8 @@ class Layout extends React.PureComponent {
4951
leftDrawerUnder: false,
5052
rightDrawerOpen: false,
5153
rightDrawerUnder: false,
54+
mainGrow: true,
55+
usingTwoRowAppBar: false,
5256
};
5357

5458
handleLeftDrawerClose = () => {
@@ -83,6 +87,7 @@ class Layout extends React.PureComponent {
8387
appBarContent,
8488
appBarPosition,
8589
appBarProps,
90+
mainGrow,
8691
leftDrawerContent,
8792
leftDrawerOpen,
8893
leftDrawerType,
@@ -97,6 +102,7 @@ class Layout extends React.PureComponent {
97102
stickyFooter,
98103
footerProps,
99104
width,
105+
usingTwoRowAppBar,
100106
} = this.props;
101107

102108
// TODO change the way to overrideClasses
@@ -116,7 +122,10 @@ class Layout extends React.PureComponent {
116122
(rightDrawerOpen && rightDrawerType === 'persistent'));
117123

118124
const mainClassnames = classNames(classes.main, {
119-
[`${classes.mainFixedAppBar}`]: appBarPosition === 'fixed',
125+
[`${classes.mainFixedAppBar}`]: appBarPosition === 'fixed' && !usingTwoRowAppBar,
126+
[`${classes.mainFixedTwoRowAppBar}`]: appBarPosition === 'fixed' && usingTwoRowAppBar,
127+
[`${classes.mainGrow}`]: mainGrow && !usingTwoRowAppBar,
128+
[`${classes.mainGrowTwoRowAppBar}`]: mainGrow && usingTwoRowAppBar,
120129
[`${classes.mainStickyFooter}`]: stickyFooter,
121130
[`${classes.mainShift}`]: mainLeftShift || mainRightShift,
122131
[`${classes.mainLeftShift}`]: mainLeftShift,

src/components/Layout/styles.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,31 @@ const styles = theme => ({
4141
}),
4242
},
4343
mainFixedAppBar: {
44-
marginTop: 56,
44+
marginTop: `${theme.mixins.toolbar.minHeight}px`,
45+
},
46+
mainFixedTwoRowAppBar: {
47+
marginTop: `${theme.mixins.toolbar.minHeight * 2}px`,
48+
},
49+
mainGrow: {
50+
flex: 1,
51+
height: `calc(100vh - ${theme.mixins.toolbar.minHeight}px)`,
52+
},
53+
mainGrowTwoRowAppBar: {
54+
flex: 1,
55+
height: `calc(100vh - ${theme.mixins.toolbar.minHeight * 2}px)`,
4556
},
4657
[theme.breakpoints.up('sm')]: {
4758
mainFixedAppBar: {
48-
marginTop: 64,
59+
marginTop: `${theme.mixins.toolbar[theme.breakpoints.up('sm')].minHeight}px`,
60+
},
61+
mainFixedTwoRowAppBar: {
62+
marginTop: `${theme.mixins.toolbar[theme.breakpoints.up('sm')].minHeight * 2}px`,
63+
},
64+
mainGrow: {
65+
height: `calc(100vh - ${theme.mixins.toolbar[theme.breakpoints.up('sm')].minHeight}px)`,
66+
},
67+
mainGrowTwoRowAppBar: {
68+
height: `calc(100vh - ${theme.mixins.toolbar[theme.breakpoints.up('sm')].minHeight * 2}px)`,
4969
},
5070
},
5171
mainStickyFooter: {

0 commit comments

Comments
 (0)