-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BottomSheet] Add BottomSheet component and refactor Drawer to also u…
…se internal SlidingSheet component.
- Loading branch information
1 parent
6d7a4ad
commit d9ef8e8
Showing
19 changed files
with
879 additions
and
280 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
35 changes: 35 additions & 0 deletions
35
docs/src/app/components/pages/components/BottomSheet/ExampleCloseable.js
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,35 @@ | ||
import React, {Component} from 'react'; | ||
import BottomSheet from 'material-ui/BottomSheet'; | ||
import MenuItem from 'material-ui/MenuItem'; | ||
import RaisedButton from 'material-ui/RaisedButton'; | ||
|
||
/** | ||
* A `BottomSheet` that can be dismissed by swiping down from the top of the sheet. | ||
*/ | ||
|
||
export default class BottomSheetExampleCloseable extends Component { | ||
|
||
constructor() { | ||
super(); | ||
this.state = {open: false}; | ||
} | ||
|
||
handleToggle = () => this.setState({open: !this.state.open}); | ||
|
||
handleClose = () => this.setState({open: false}); | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<RaisedButton | ||
label="Toggle BottomSheet" | ||
onTouchTap={this.handleToggle} | ||
/> | ||
<BottomSheet open={this.state.open} onRequestClose={this.handleClose}> | ||
<MenuItem>Menu item 1</MenuItem> | ||
<MenuItem>Menu item 2</MenuItem> | ||
</BottomSheet> | ||
</div> | ||
); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
docs/src/app/components/pages/components/BottomSheet/ExampleInset.js
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,35 @@ | ||
import React, {Component} from 'react'; | ||
import BottomSheet from 'material-ui/BottomSheet'; | ||
import MenuItem from 'material-ui/MenuItem'; | ||
import RaisedButton from 'material-ui/RaisedButton'; | ||
|
||
/** | ||
* An inset `BottomSheet` with a custom width. | ||
*/ | ||
|
||
export default class BottomSheetExampleInset extends Component { | ||
|
||
constructor() { | ||
super(); | ||
this.state = {open: false}; | ||
} | ||
|
||
handleToggle = () => this.setState({open: !this.state.open}); | ||
|
||
handleClose = () => this.setState({open: false}); | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<RaisedButton | ||
label="Toggle BottomSheet" | ||
onTouchTap={this.handleToggle} | ||
/> | ||
<BottomSheet open={this.state.open} width="80%" onRequestClose={this.handleClose}> | ||
<MenuItem>Menu item 1</MenuItem> | ||
<MenuItem>Menu item 2</MenuItem> | ||
</BottomSheet> | ||
</div> | ||
); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
docs/src/app/components/pages/components/BottomSheet/ExampleModal.js
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,39 @@ | ||
import React, {Component} from 'react'; | ||
import BottomSheet from 'material-ui/BottomSheet'; | ||
import MenuItem from 'material-ui/MenuItem'; | ||
import RaisedButton from 'material-ui/RaisedButton'; | ||
|
||
/** | ||
* A modal `BottomSheet`. When opened, the page is covered with an overlay. Touching | ||
* the overlay or swiping down will dismiss the `BottomSheet`. | ||
*/ | ||
|
||
export default class BottomSheetExampleModal extends Component { | ||
|
||
constructor() { | ||
super(); | ||
this.state = {open: false}; | ||
} | ||
|
||
handleToggle = () => this.setState({open: !this.state.open}); | ||
|
||
handleClose = () => this.setState({open: false}); | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<RaisedButton | ||
label="Toggle BottomSheet" | ||
onTouchTap={this.handleToggle} | ||
/> | ||
<BottomSheet open={this.state.open} modal={true} onRequestClose={this.handleClose}> | ||
<MenuItem>Menu item 1</MenuItem> | ||
<MenuItem>Menu item 2</MenuItem> | ||
<MenuItem>Menu item 3</MenuItem> | ||
<MenuItem>Menu item 4</MenuItem> | ||
<MenuItem>Menu item 5</MenuItem> | ||
</BottomSheet> | ||
</div> | ||
); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
docs/src/app/components/pages/components/BottomSheet/ExampleSimple.js
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,33 @@ | ||
import React, {Component} from 'react'; | ||
import BottomSheet from 'material-ui/BottomSheet'; | ||
import MenuItem from 'material-ui/MenuItem'; | ||
import RaisedButton from 'material-ui/RaisedButton'; | ||
|
||
/** | ||
* A simple persistent `BottomSheet`, controlled through the `open` prop. | ||
*/ | ||
|
||
export default class BottomSheetExampleSimple extends Component { | ||
|
||
constructor() { | ||
super(); | ||
this.state = {open: false}; | ||
} | ||
|
||
handleToggle = () => this.setState({open: !this.state.open}); | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<RaisedButton | ||
label="Toggle BottomSheet" | ||
onTouchTap={this.handleToggle} | ||
/> | ||
<BottomSheet open={this.state.open}> | ||
<MenuItem>Menu item 1</MenuItem> | ||
<MenuItem>Menu item 2</MenuItem> | ||
</BottomSheet> | ||
</div> | ||
); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
docs/src/app/components/pages/components/BottomSheet/Page.js
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,51 @@ | ||
import React from 'react'; | ||
import Title from 'react-title-component'; | ||
|
||
import CodeExample from '../../../CodeExample'; | ||
import PropTypeDescription from '../../../PropTypeDescription'; | ||
import MarkdownElement from '../../../MarkdownElement'; | ||
|
||
import bottomSheetReadmeText from './README'; | ||
import BottomSheetExampleSimple from './ExampleSimple'; | ||
import bottomSheetExampleSimpleCode from '!raw!./ExampleSimple'; | ||
import BottomSheetExampleCloseable from './ExampleCloseable'; | ||
import bottomSheetExampleCloseableCode from '!raw!./ExampleCloseable'; | ||
import BottomSheetExampleInset from './ExampleInset'; | ||
import bottomSheetExampleInsetCode from '!raw!./ExampleInset'; | ||
import BottomSheetExampleModal from './ExampleModal'; | ||
import bottomSheetExampleModalCode from '!raw!./ExampleModal'; | ||
import bottomSheetCode from '!raw!material-ui/BottomSheet/BottomSheet'; | ||
|
||
const BottomSheetPage = () => ( | ||
<div> | ||
<Title render={(previousTitle) => `Bottom Sheet - ${previousTitle}`} /> | ||
<MarkdownElement text={bottomSheetReadmeText} /> | ||
<CodeExample | ||
title="Simple example" | ||
code={bottomSheetExampleSimpleCode} | ||
> | ||
<BottomSheetExampleSimple /> | ||
</CodeExample> | ||
<CodeExample | ||
title="Closeable example" | ||
code={bottomSheetExampleCloseableCode} | ||
> | ||
<BottomSheetExampleCloseable /> | ||
</CodeExample> | ||
<CodeExample | ||
title="Inset example" | ||
code={bottomSheetExampleInsetCode} | ||
> | ||
<BottomSheetExampleInset /> | ||
</CodeExample> | ||
<CodeExample | ||
title="Modal example" | ||
code={bottomSheetExampleModalCode} | ||
> | ||
<BottomSheetExampleModal /> | ||
</CodeExample> | ||
<PropTypeDescription code={bottomSheetCode} /> | ||
</div> | ||
); | ||
|
||
export default BottomSheetPage; |
6 changes: 6 additions & 0 deletions
6
docs/src/app/components/pages/components/BottomSheet/README.md
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,6 @@ | ||
## BottomSheet | ||
|
||
The [BottomSheet](https://www.google.com/design/spec/components/bottom-sheets.html) slides up from the bottom. | ||
It is most commonly used on mobile. | ||
|
||
### Examples |
12 changes: 8 additions & 4 deletions
12
docs/src/app/components/pages/components/Drawer/ExampleOpenSecondary.js
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
13 changes: 9 additions & 4 deletions
13
docs/src/app/components/pages/components/Drawer/ExampleSimple.js
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
14 changes: 10 additions & 4 deletions
14
docs/src/app/components/pages/components/Drawer/ExampleUndocked.js
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
Oops, something went wrong.