Clean up InfoButton
Signed-off-by: Bastian <matrix@noxware.de>
This commit is contained in:
parent
4dcbb6fc0f
commit
7428e97910
1 changed files with 4 additions and 21 deletions
|
@ -26,38 +26,24 @@ export default React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
title: PropTypes.string,
|
title: PropTypes.string,
|
||||||
description: PropTypes.node,
|
description: PropTypes.node,
|
||||||
extraButtons: PropTypes.node,
|
|
||||||
button: PropTypes.string,
|
button: PropTypes.string,
|
||||||
danger: PropTypes.bool,
|
onFinished: PropTypes.func,
|
||||||
focus: PropTypes.bool,
|
|
||||||
onFinished: PropTypes.func.isRequired,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
return {
|
return {
|
||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
extraButtons: null,
|
|
||||||
focus: true,
|
|
||||||
danger: false,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
onOk: function() {
|
onFinished: function() {
|
||||||
this.props.onFinished(true);
|
this.props.onFinished();
|
||||||
},
|
|
||||||
|
|
||||||
onCancel: function() {
|
|
||||||
this.props.onFinished(false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
||||||
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
const DialogButtons = sdk.getComponent('views.elements.DialogButtons');
|
||||||
let primaryButtonClass = "";
|
|
||||||
if (this.props.danger) {
|
|
||||||
primaryButtonClass = "danger";
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<BaseDialog className="mx_InfoDialog" onFinished={this.props.onFinished}
|
<BaseDialog className="mx_InfoDialog" onFinished={this.props.onFinished}
|
||||||
title={this.props.title}
|
title={this.props.title}
|
||||||
|
@ -68,12 +54,9 @@ export default React.createClass({
|
||||||
{ this.props.description }
|
{ this.props.description }
|
||||||
</div>
|
</div>
|
||||||
<DialogButtons primaryButton={this.props.button || _t('OK')}
|
<DialogButtons primaryButton={this.props.button || _t('OK')}
|
||||||
primaryButtonClass={primaryButtonClass}
|
onPrimaryButtonClick={this.onFinished}
|
||||||
onPrimaryButtonClick={this.onOk}
|
|
||||||
hasCancel={false}
|
hasCancel={false}
|
||||||
focus={this.props.focus}
|
|
||||||
>
|
>
|
||||||
{ this.props.extraButtons }
|
|
||||||
</DialogButtons>
|
</DialogButtons>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue