Skip to content

Commit

Permalink
Added onDismiss event to dialog. Fixes #86
Browse files Browse the repository at this point in the history
  • Loading branch information
Hai Nguyen committed Nov 30, 2014
1 parent 4551a24 commit 3c0556a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/src/app/components/pages/components/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ var DialogPage = React.createClass({
<h3 className="mui-font-style-title">Methods</h3>
{this._getMethodInfo()}

<br/><hr/><br/>

<h3 className="mui-font-style-title">Events</h3>
{this._getEventInfo()}

<Dialog ref="dialogExample" title="Title" actions={dialogActions}>
This is an example of a dialog component built with Facebook's React and following
Google's Material Design principles.
Expand Down Expand Up @@ -90,6 +95,23 @@ var DialogPage = React.createClass({
}
];

return <ComponentInfo infoArray={info} />;
},

_getEventInfo: function() {
var info = [
{
name: 'onDismiss',
header: 'function()',
desc: 'Fired when the dialog is dismissed.'
},
{
name: 'onShow',
header: 'function()',
desc: 'Fired when the dialog is shown.'
}
];

return <ComponentInfo infoArray={info} />;
}

Expand Down
2 changes: 2 additions & 0 deletions src/js/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var Dialog = React.createClass({
openImmediately: React.PropTypes.bool,
title: React.PropTypes.string,
actions: React.PropTypes.array,
onDismiss: React.PropTypes.func,
onShow: React.PropTypes.func
},

Expand Down Expand Up @@ -69,6 +70,7 @@ var Dialog = React.createClass({

dismiss: function() {
this.setState({ open: false });
if (this.props.onDismiss) this.props.onDismiss();
},

show: function() {
Expand Down

0 comments on commit 3c0556a

Please sign in to comment.