mirror of https://github.com/vector-im/riot-web
Add customisable cancel button to QuestionDialog
parent
1895f82d62
commit
31dcd85c08
|
@ -67,6 +67,7 @@ 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')}
|
||||||
|
cancelButton={this.props.cancelButton}
|
||||||
onPrimaryButtonClick={this.onOk}
|
onPrimaryButtonClick={this.onOk}
|
||||||
primaryButtonClass={primaryButtonClass}
|
primaryButtonClass={primaryButtonClass}
|
||||||
focus={this.props.focus}
|
focus={this.props.focus}
|
||||||
|
|
|
@ -29,6 +29,9 @@ module.exports = React.createClass({
|
||||||
// The primary button which is styled differently and has default focus.
|
// The primary button which is styled differently and has default focus.
|
||||||
primaryButton: PropTypes.node.isRequired,
|
primaryButton: PropTypes.node.isRequired,
|
||||||
|
|
||||||
|
// A node to insert into the cancel button instead of default "Cancel"
|
||||||
|
cancelButton: PropTypes.node,
|
||||||
|
|
||||||
// onClick handler for the primary button.
|
// onClick handler for the primary button.
|
||||||
onPrimaryButtonClick: PropTypes.func.isRequired,
|
onPrimaryButtonClick: PropTypes.func.isRequired,
|
||||||
|
|
||||||
|
@ -60,9 +63,9 @@ module.exports = React.createClass({
|
||||||
primaryButtonClassName += " " + this.props.primaryButtonClass;
|
primaryButtonClassName += " " + this.props.primaryButtonClass;
|
||||||
}
|
}
|
||||||
let cancelButton;
|
let cancelButton;
|
||||||
if (this.props.hasCancel) {
|
if (this.props.cancelButton || this.props.hasCancel) {
|
||||||
cancelButton = <button onClick={this._onCancelClick} disabled={this.props.disabled}>
|
cancelButton = <button onClick={this._onCancelClick} disabled={this.props.disabled}>
|
||||||
{ _t("Cancel") }
|
{ this.props.cancelButton || _t("Cancel") }
|
||||||
</button>;
|
</button>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue