react-toolbox/spec/components/dialog.jsx

45 lines
867 B
React
Raw Normal View History

2015-09-21 11:01:52 +03:00
/* global React */
import Button from '../../components/button';
import Dialog from '../../components/dialog';
export default React.createClass({
displayName: 'DialogTest',
getInitialState () {
return {
actions: [{
2015-10-06 08:21:24 +03:00
label: 'Close', type: 'flat', className:'primary', onClick: this.onClose
2015-09-21 11:01:52 +03:00
}]
};
},
onClose () {
2015-10-06 08:21:24 +03:00
console.log('a');
2015-09-21 11:01:52 +03:00
this.refs.dialog.hide();
},
onShow () {
this.refs.dialog.show();
},
render () {
return (
<section>
<h2>Dialog</h2>
<p>lorem ipsum...</p>
<Button type='raised' label='Show Dialog' onClick={this.onShow} />
2015-10-06 08:21:24 +03:00
<Dialog
ref='dialog'
type='small'
title='Your profile'
actions={this.state.actions}
>
2015-09-21 11:01:52 +03:00
<p>Welcome to your first Dialog</p>
</Dialog>
</section>
);
}
});