Add method to Modal to create dialog with instantiated React elements as well as Classes.

This commit is contained in:
David Baker 2015-10-09 11:54:46 +01:00
parent 05f7a3b4d1
commit 0791cac572
3 changed files with 28 additions and 9 deletions

View file

@ -34,6 +34,29 @@ module.exports = {
return container;
},
createDialogWithElement: function(element, props) {
var self = this;
var closeDialog = function() {
React.unmountComponentAtNode(self.getOrCreateContainer());
if (props && props.onFinished) props.onFinished.apply(null, arguments);
};
var dialog = (
<div className="mx_Dialog_wrapper">
<div className="mx_Dialog">
{element}
</div>
<div className="mx_Dialog_background" onClick={closeDialog}></div>
</div>
);
React.render(dialog, this.getOrCreateContainer());
return {close: closeDialog};
},
createDialog: function (Element, props) {
var self = this;