summaryrefslogtreecommitdiff
path: root/frontend/src/components/modals/ConfirmationModal.js
blob: abdce5acfc74df04f9ae9700d7cccb099ba553fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import PropTypes from "prop-types";
import React from "react";
import Modal from "./Modal";

class ConfirmationModal extends React.Component {
  static propTypes = {
    title: PropTypes.string.isRequired,
    message: PropTypes.string.isRequired,
    show: PropTypes.bool.isRequired,
    callback: PropTypes.func.isRequired
  };

  onConfirm() {
    this.props.callback(true);
  }

  onCancel() {
    this.props.callback(false);
  }

  render() {
    return (
      <Modal
        title={this.props.title}
        show={this.props.show}
        onSubmit={this.onConfirm.bind(this)}
        onCancel={this.onCancel.bind(this)}
        submitButtonType="danger"
        submitButtonText="Confirm"
      >
        {this.props.message}
      </Modal>
    );
  }
}

export default ConfirmationModal;