summaryrefslogtreecommitdiff
path: root/ui/app/components/confirmation.js
blob: 46f69e293d68fa072d6eed27d9dd66fdcc95dd8d (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
38
39
40
41
42
43
44
45
46
47
//
// A simple diagon that asks if you are sure.
//

import React from 'react'
import {Button, ButtonToolbar, Modal} from 'react-bootstrap'
import PropTypes from 'prop-types'

const Confirmation = props => (
  <Modal show={props.show}>
    <Modal.Header closeButton>
      <Modal.Title>
        {props.title}
      </Modal.Title>
    </Modal.Header>
    <Modal.Body>
      <ButtonToolbar>
        <Button onClick={props.onAccept} bsStyle="success">
          {props.acceptStr}
        </Button>
        <Button onClick={props.onCancel}>
          {props.cancelStr}
        </Button>
      </ButtonToolbar>
    </Modal.Body>
  </Modal>
)

Confirmation.defaultProps = {
  show: true,
  title: "Are you sure?",
  onCancel: null,
  onAccept: null,
  acceptStr: 'Accept',
  cancelStr: 'Cancel'
}

Confirmation.propTypes = {
  show: PropTypes.bool,
  className: PropTypes.string,
  onCancel: PropTypes.func.isRequired,
  onAccept: PropTypes.func.isRequired,
  acceptStr: PropTypes.string,
  cancelStr:  PropTypes.string
}

export default Confirmation