diff options
Diffstat (limited to 'app/javascript/flavours/glitch/features/ui')
-rw-r--r-- | app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js b/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js index 07281f818..970df30b6 100644 --- a/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js +++ b/app/javascript/flavours/glitch/features/ui/components/confirmation_modal.js @@ -11,6 +11,8 @@ export default class ConfirmationModal extends React.PureComponent { confirm: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, onConfirm: PropTypes.func.isRequired, + secondary: PropTypes.string, + onSecondary: PropTypes.func, onDoNotAsk: PropTypes.func, intl: PropTypes.object.isRequired, }; @@ -27,6 +29,11 @@ export default class ConfirmationModal extends React.PureComponent { } } + handleSecondary = () => { + this.props.onClose(); + this.props.onSecondary(); + } + handleCancel = () => { this.props.onClose(); } @@ -40,7 +47,7 @@ export default class ConfirmationModal extends React.PureComponent { } render () { - const { message, confirm, onDoNotAsk } = this.props; + const { message, confirm, secondary, onDoNotAsk } = this.props; return ( <div className='modal-root__modal confirmation-modal'> @@ -61,6 +68,9 @@ export default 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> |