You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-20 16:22:28 +03:00
Use DialogButtons in ConfirmUserActionDialog
Use DialogButtons to eliminate duplicate button code.
This commit is contained in:
@@ -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>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user