-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(drawer): initialize foundation if props.open updates (#427)
- Loading branch information
Matt Goo
committed
Nov 20, 2018
1 parent
c2fa3a3
commit 36e6316
Showing
5 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import DrawerTest from './DrawerTest'; | ||
|
||
class PermanentToModalDrawerScreenshotTest extends React.Component { | ||
|
||
state = { | ||
isPhone: window.innerWidth < 599, | ||
}; | ||
|
||
componentDidMount() { | ||
window.addEventListener('resize', this.updateDrawerVariant); | ||
} | ||
|
||
shouldComponentUpdate(_, nextState) { | ||
if (nextState.isPhone === this.state.isPhone) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
componentWillUnmount() { | ||
window.removeEventListener('resize', this.updateDrawerVariant); | ||
} | ||
|
||
updateDrawerVariant = () => { | ||
const isPhone = window.innerWidth < 599; | ||
this.setState({isPhone}); | ||
} | ||
|
||
render() { | ||
if (this.state.isPhone) { | ||
return <DrawerTest open={false} modal title='Modal Drawer' />; | ||
} | ||
return <DrawerTest hideNavigationIcon title='Permanent Drawer' />; | ||
} | ||
}; | ||
|
||
export default PermanentToModalDrawerScreenshotTest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ export default [ | |
'modal', | ||
'permanentBelowTopAppBar', | ||
'dismissibleBelowTopAppBar', | ||
'permanentToModal', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters