0
0
Fork 0

Add a “Block & Report” button to the block confirmation dialog (#10360)

This commit is contained in:
ThibG 2019-03-26 17:34:02 +01:00 committed by Eugen Rochko
parent 0c46bd11aa
commit 6df4a82969
8 changed files with 44 additions and 6 deletions

View file

@ -11,6 +11,8 @@ class ConfirmationModal extends React.PureComponent {
confirm: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
onConfirm: PropTypes.func.isRequired,
secondary: PropTypes.string,
onSecondary: PropTypes.func,
intl: PropTypes.object.isRequired,
};
@ -23,6 +25,11 @@ class ConfirmationModal extends React.PureComponent {
this.props.onConfirm();
}
handleSecondary = () => {
this.props.onClose();
this.props.onSecondary();
}
handleCancel = () => {
this.props.onClose();
}
@ -32,7 +39,7 @@ class ConfirmationModal extends React.PureComponent {
}
render () {
const { message, confirm } = this.props;
const { message, confirm, secondary } = this.props;
return (
<div className='modal-root__modal confirmation-modal'>
@ -44,6 +51,9 @@ class ConfirmationModal extends React.PureComponent {
<Button onClick={this.handleCancel} className='confirmation-modal__cancel-button'>
<FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' />
</Button>
{secondary !== undefined && (
<Button text={secondary} onClick={this.handleSecondary} className='confirmation-modal__secondary-button' />
)}
<Button text={confirm} onClick={this.handleClick} ref={this.setRef} />
</div>
</div>