react-toolbox/docs/app/components/layout/main/modules/examples/dialog_example_1.txt

34 lines
778 B
Plaintext
Raw Normal View History

2015-10-31 22:35:19 +03:00
class DialogTest extends React.Component {
2015-11-05 13:28:42 +03:00
state = {
active: false
2015-10-31 22:35:19 +03:00
};
2015-11-05 13:28:42 +03:00
handleToggle = () => {
this.setState({active: !this.state.active});
}
2015-10-31 22:35:19 +03:00
actions = [
2015-11-05 13:28:42 +03:00
{ label: "Cancel", onClick: this.handleToggle },
{ label: "Save", onClick: this.handleToggle }
2015-10-31 22:35:19 +03:00
];
render () {
return (
<div>
2015-11-05 13:28:42 +03:00
<Button label='Show my dialog' onClick={this.handleToggle} />
<Dialog
actions={this.actions}
active={this.state.active}
onEscKeyDown={this.handleToggle}
2015-11-05 13:28:42 +03:00
onOverlayClick={this.handleToggle}
title='My awesome dialog'
2015-11-05 13:28:42 +03:00
>
2015-10-31 22:35:19 +03:00
<p>Here you can add arbitrary content. Components like Pickers are using dialogs now.</p>
</Dialog>
</div>
);
}
}
return <DialogTest />;