Last active
September 15, 2016 09:20
-
-
Save markshust/533d702dfb084ad337e2 to your computer and use it in GitHub Desktop.
custom dialog box using reactjs version of material design (material-ui)
This file contains hidden or 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
| const { Dialog, FlatButton, RaisedButton } = mui; | |
| CustomDialog = React.createClass({ | |
| getInitialState() { | |
| return { | |
| showDialog: false | |
| }; | |
| }, | |
| handlePrompt() { | |
| this.setState({showDialog: true}); | |
| }, | |
| handleCancel() { | |
| this.setState({showDialog: false}); | |
| }, | |
| handleConfirm() { | |
| // Dialog button action here | |
| }, | |
| render() { | |
| return ( | |
| <div className='custom-dialog'> | |
| <RaisedButton | |
| label='Action Name' | |
| onTouchTap={this.handlePrompt} | |
| primary={true} | |
| /> | |
| <Dialog | |
| title='Dialog Title' | |
| open={this.state.showDialog} | |
| actions={[ | |
| <FlatButton | |
| label='Cancel' | |
| onTouchTap={this.handleCancel} | |
| style={{marginRight: 10}} | |
| key={0} | |
| />, | |
| <FlatButton | |
| label='Confirm' | |
| onTouchTap={this.handleConfirm} | |
| primary={true} | |
| key={1} | |
| /> | |
| ]} | |
| onRequestClose={() => this.handleCancel()} | |
| > | |
| Are you sure you want to do this? | |
| </Dialog> | |
| </div> | |
| ); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment