Use DialogButtons in ConfirmUserActionDialog
Use DialogButtons to eliminate duplicate button code.
This commit is contained in:
parent
7a761dbf6b
commit
93b789438b
1 changed files with 7 additions and 15 deletions
|
@ -76,13 +76,11 @@ export default React.createClass({
|
||||||
|
|
||||||
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 MemberAvatar = sdk.getComponent("views.avatars.MemberAvatar");
|
const MemberAvatar = sdk.getComponent("views.avatars.MemberAvatar");
|
||||||
const BaseAvatar = sdk.getComponent("views.avatars.BaseAvatar");
|
const BaseAvatar = sdk.getComponent("views.avatars.BaseAvatar");
|
||||||
|
|
||||||
const confirmButtonClass = classnames({
|
const confirmButtonClass = this.props.danger ? 'danger' : '';
|
||||||
'mx_Dialog_primary': true,
|
|
||||||
'danger': this.props.danger,
|
|
||||||
});
|
|
||||||
|
|
||||||
let reasonBox;
|
let reasonBox;
|
||||||
if (this.props.askReason) {
|
if (this.props.askReason) {
|
||||||
|
@ -127,17 +125,11 @@ export default React.createClass({
|
||||||
<div className="mx_ConfirmUserActionDialog_userId">{ userId }</div>
|
<div className="mx_ConfirmUserActionDialog_userId">{ userId }</div>
|
||||||
</div>
|
</div>
|
||||||
{ reasonBox }
|
{ reasonBox }
|
||||||
<div className="mx_Dialog_buttons">
|
<DialogButtons primaryButton={this.props.action}
|
||||||
<button className={confirmButtonClass}
|
onPrimaryButtonClick={this.onOk}
|
||||||
onClick={this.onOk} autoFocus={!this.props.askReason}
|
primaryButtonClass={confirmButtonClass}
|
||||||
>
|
focus={!this.props.askReason}
|
||||||
{ this.props.action }
|
onCancel={this.onCancel} />
|
||||||
</button>
|
|
||||||
|
|
||||||
<button onClick={this.onCancel}>
|
|
||||||
{ _t("Cancel") }
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue