summaryrefslogtreecommitdiff
path: root/ui/app/components/confirmation.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/confirmation.js')
-rw-r--r--ui/app/components/confirmation.js68
1 files changed, 35 insertions, 33 deletions
diff --git a/ui/app/components/confirmation.js b/ui/app/components/confirmation.js
index 69186162..deceb47b 100644
--- a/ui/app/components/confirmation.js
+++ b/ui/app/components/confirmation.js
@@ -3,41 +3,43 @@
//
import React from 'react'
-import {Button, ButtonGroup, ButtonToolbar, Glyphicon, Modal}
- from 'react-bootstrap'
+import {Button, ButtonToolbar, Modal} from 'react-bootstrap'
+import PropTypes from 'prop-types'
-export default class Confirmation extends React.Component {
+const Confirmation = props => (
+ <Modal>
+ <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>
+)
- static get defaultProps() {return{
- title: "Are you sure?",
- onCancel: null,
- onAccept: null,
- acceptStr: 'Accept',
- cancelStr: 'Cancel'
- }}
-
- constructor(props) {
- super(props)
- }
+Confirmation.defaultProps = {
+ title: "Are you sure?",
+ onCancel: null,
+ onAccept: null,
+ acceptStr: 'Accept',
+ cancelStr: 'Cancel'
+}
- render() {
- return (
- <Modal show={true} onHide={this.props.onCancel}>
- <Modal.Header closeButton>
- <Modal.Title>{this.props.title}</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <ButtonToolbar>
- <Button onClick={this.props.onAccept} bsStyle="success">
- {this.props.acceptStr}
- </Button>
- <Button onClick={this.props.onCancel}>
- {this.props.cancelStr}
- </Button>
- </ButtonToolbar>
- </Modal.Body>
- </Modal>
- )
- }
+Confirmation.propTypes = {
+ className: PropTypes.string,
+ onCancel: PropTypes.func.isRequired,
+ onAccept: PropTypes.func.isRequired,
+ acceptStr: PropTypes.string,
+ cancelStr: PropTypes.string
}
+export default Confirmation