@@ -23,32 +23,35 @@ class Layout extends React.PureComponent {
23
23
stickyFooter : PropTypes . bool ,
24
24
footerContent : PropTypes . element ,
25
25
appBarContent : PropTypes . element ,
26
- drawerOpen : PropTypes . bool . isRequired ,
27
- onDrawerOpenChange : PropTypes . func ,
28
- drawerContent : PropTypes . element ,
26
+ leftDrawerOpen : PropTypes . bool . isRequired ,
27
+ onLeftDrawerOpenChange : PropTypes . func ,
28
+ leftDrawerContent : PropTypes . element ,
29
+ leftDrawerType : PropTypes . string ,
30
+ leftDrawerUnder : PropTypes . bool ,
29
31
appBarProps : PropTypes . shape ( { } ) ,
30
- drawerProps : PropTypes . shape ( { } ) ,
32
+ leftDrawerProps : PropTypes . shape ( { } ) ,
31
33
footerProps : PropTypes . shape ( { } ) ,
34
+ width : PropTypes . string ,
32
35
} ;
33
36
34
37
static defaultProps = {
35
38
title : '' ,
36
39
appBarPosition : 'fixed' ,
37
40
stickyFooter : false ,
38
- drawerOpen : false ,
39
- drawerUnder : false ,
41
+ leftDrawerOpen : false ,
42
+ leftDrawerUnder : false ,
40
43
} ;
41
44
42
- handleDrawerClose = ( ) => {
43
- if ( ! this . props . onDrawerOpenChange ) return ;
45
+ handleLeftDrawerClose = ( ) => {
46
+ if ( ! this . props . onLeftDrawerOpenChange ) return ;
44
47
45
- this . props . onDrawerOpenChange ( false ) ;
48
+ this . props . onLeftDrawerOpenChange ( false ) ;
46
49
} ;
47
50
48
- toggleDrawer = ( ) => {
49
- if ( ! this . props . onDrawerOpenChange ) return ;
51
+ toggleLeftDrawer = ( ) => {
52
+ if ( ! this . props . onLeftDrawerOpenChange ) return ;
50
53
51
- this . props . onDrawerOpenChange ( ! this . props . drawerOpen ) ;
54
+ this . props . onLeftDrawerOpenChange ( ! this . props . leftDrawerOpen ) ;
52
55
} ;
53
56
54
57
render ( ) {
@@ -59,11 +62,11 @@ class Layout extends React.PureComponent {
59
62
appBarContent,
60
63
appBarPosition,
61
64
appBarProps,
62
- drawerContent ,
63
- drawerOpen ,
64
- drawerType ,
65
- drawerUnder ,
66
- drawerProps ,
65
+ leftDrawerContent ,
66
+ leftDrawerOpen ,
67
+ leftDrawerType ,
68
+ leftDrawerUnder ,
69
+ leftDrawerProps ,
67
70
footerContent,
68
71
stickyFooter,
69
72
footerProps,
@@ -78,8 +81,8 @@ class Layout extends React.PureComponent {
78
81
79
82
const mainShift =
80
83
! smallScreen &&
81
- ( drawerType === 'permanent' ||
82
- ( drawerOpen && drawerType === 'persistent' ) ) ;
84
+ ( leftDrawerType === 'permanent' ||
85
+ ( leftDrawerOpen && leftDrawerType === 'persistent' ) ) ;
83
86
84
87
const mainClassnames = classNames (
85
88
classes . main ,
@@ -90,40 +93,40 @@ class Layout extends React.PureComponent {
90
93
91
94
const appBarShift =
92
95
! smallScreen &&
93
- ( ! drawerUnder &&
94
- ( ( drawerOpen && drawerType === 'persistent' ) ||
95
- drawerType === 'permanent' ) ) ;
96
+ ( ! leftDrawerUnder &&
97
+ ( ( leftDrawerOpen && leftDrawerType === 'persistent' ) ||
98
+ leftDrawerType === 'permanent' ) ) ;
96
99
97
100
const appBarClassnames = classNames ( classes . appBar , {
98
101
[ `${ classes . appBarShift } ` ] : appBarShift ,
99
102
} ) ;
100
103
101
104
const drawerPaperClassnames = classNames ( classes . drawerPaper , {
102
- [ `${ classes . drawerPaperUnder } ` ] : ! smallScreen && drawerUnder ,
105
+ [ `${ classes . drawerPaperUnder } ` ] : ! smallScreen && leftDrawerUnder ,
103
106
} ) ;
104
107
105
108
return (
106
109
< div className = { classes . layout } >
107
110
< AppBar
108
111
position = { appBarPosition }
109
- onIconClick = { this . toggleDrawer }
112
+ onIconClick = { this . toggleLeftDrawer }
110
113
className = { appBarClassnames }
111
114
{ ...appBarProps }
112
115
>
113
116
{ appBarContent }
114
117
</ AppBar >
115
- { drawerContent ? (
118
+ { leftDrawerContent ? (
116
119
< Drawer
117
- open = { drawerOpen }
118
- onRequestClose = { this . handleDrawerClose }
119
- type = { ! smallScreen && drawerType }
120
+ open = { leftDrawerOpen }
121
+ onRequestClose = { this . handleLeftDrawerClose }
122
+ type = { ! smallScreen && leftDrawerType }
120
123
classes = { { paper : drawerPaperClassnames } }
121
- { ...drawerProps }
124
+ { ...leftDrawerProps }
122
125
>
123
- { ! smallScreen && drawerUnder ? (
126
+ { ! smallScreen && leftDrawerUnder ? (
124
127
< div className = { classes . drawerHeader } />
125
128
) : null }
126
- { drawerContent }
129
+ { leftDrawerContent }
127
130
</ Drawer >
128
131
) : null }
129
132
< main className = { mainClassnames } > { children } </ main >
@@ -136,5 +139,5 @@ class Layout extends React.PureComponent {
136
139
}
137
140
138
141
export default controllable ( compose ( withStyles ( styles ) , withWidth ( ) ) ( Layout ) , [
139
- 'drawerOpen ' ,
142
+ 'leftDrawerOpen ' ,
140
143
] ) ;
0 commit comments