-
-
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.
Merge pull request #2483 from subjectix/doc-codegen-dialog
[Doc] Convert Dialog to use the new standard.
- Loading branch information
Showing
7 changed files
with
417 additions
and
494 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import Dialog from 'material-ui/lib/dialog'; | ||
import FlatButton from 'material-ui/lib/flat-button'; | ||
import RaisedButton from 'material-ui/lib/raised-button'; | ||
|
||
const DialogExampleModal = React.createClass({ | ||
|
||
getInitialState() { | ||
return {open: false}; | ||
}, | ||
|
||
handleOpen() { | ||
this.setState({open: true}); | ||
}, | ||
|
||
handleClose() { | ||
this.setState({open: false}); | ||
}, | ||
|
||
render() { | ||
const actions = [ | ||
<FlatButton | ||
label="Cancel" | ||
secondary={true} | ||
onTouchTap={this.handleClose} />, | ||
<FlatButton | ||
label="Submit" | ||
primary={true} | ||
disabled={true} | ||
onTouchTap={this.handleClose} />, | ||
]; | ||
|
||
return ( | ||
<RaisedButton label="Modal Dialog" onTouchTap={this.handleOpen}> | ||
<Dialog | ||
title="Dialog With Actions" | ||
actions={actions} | ||
modal={true} | ||
open={this.state.open}> | ||
Only actions can close this dialog. | ||
</Dialog> | ||
</RaisedButton> | ||
); | ||
}, | ||
}); | ||
|
||
export default DialogExampleModal; |
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,48 @@ | ||
import React from 'react'; | ||
import Dialog from 'material-ui/lib/dialog'; | ||
import FlatButton from 'material-ui/lib/flat-button'; | ||
import RaisedButton from 'material-ui/lib/raised-button'; | ||
|
||
const DialogExampleSimple = React.createClass({ | ||
|
||
getInitialState() { | ||
return {open: false}; | ||
}, | ||
|
||
handleOpen() { | ||
this.setState({open: true}); | ||
}, | ||
|
||
handleClose() { | ||
this.setState({open: false}); | ||
}, | ||
|
||
render() { | ||
const actions = [ | ||
<FlatButton | ||
label="Cancel" | ||
secondary={true} | ||
onTouchTap={this.handleClose} />, | ||
<FlatButton | ||
label="Submit" | ||
primary={true} | ||
keyboardFocused={true} | ||
onTouchTap={this.handleClose} />, | ||
]; | ||
|
||
return ( | ||
<RaisedButton label="Dialog With Actions" onTouchTap={this.handleOpen}> | ||
<Dialog | ||
title="Dialog With Actions" | ||
actions={actions} | ||
modal={false} | ||
open={this.state.open} | ||
onRequestClose={this.handleClose}> | ||
The actions in this window were passed in as an array of react objects. | ||
</Dialog> | ||
</RaisedButton> | ||
); | ||
}, | ||
}); | ||
|
||
export default DialogExampleSimple; |
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,9 @@ | ||
## Dialog | ||
|
||
For more information on the `Dialog` please visit the Material Design's | ||
specifications [here](https://www.google.com/design/spec/components/dialogs.html). | ||
|
||
Dialog can only be a controlled component. | ||
You must provide the open prop and handle `onRequestClose` in order to use this component. | ||
|
||
### Examples |
Oops, something went wrong.