Skip to content

Commit

Permalink
Merge pull request #2483 from subjectix/doc-codegen-dialog
Browse files Browse the repository at this point in the history
[Doc] Convert Dialog to use the new standard.
  • Loading branch information
alitaheri committed Dec 14, 2015
2 parents 46ceed1 + 4074a1f commit 37f71b6
Show file tree
Hide file tree
Showing 7 changed files with 417 additions and 494 deletions.
47 changes: 47 additions & 0 deletions docs/src/app/components/Dialog/ExampleModal.jsx
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;
48 changes: 48 additions & 0 deletions docs/src/app/components/Dialog/ExampleSimple.jsx
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;
9 changes: 9 additions & 0 deletions docs/src/app/components/Dialog/README.md
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
Loading

0 comments on commit 37f71b6

Please sign in to comment.