-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathDeleteDraftModal.jsx
62 lines (55 loc) · 1.29 KB
/
DeleteDraftModal.jsx
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react'
import PropTypes from 'prop-types'
import Button from 'react-bootstrap/Button'
import Modal from 'react-bootstrap/Modal'
/**
* @typedef {Object} DeleteDraftModalProps
* @property {Boolean} show Should the modal be open.
* @property {Function} closeModal A function to close the modal.
* @property {Function} onDelete A callback function triggered when the user selects `Yes`.
*/
/**
* Renders a DeleteDraftModal component
*
* @component
* @example <caption>Render a DeleteDraftModal</caption>
* return (
* <DeleteDraftModal
* show={showDeleteModal}
* closeModal={handleClose}
* onDelete={handleDelete}
* />
* )
*/
const DeleteDraftModal = ({
closeModal,
onDelete,
show
}) => (
<Modal
onHide={closeModal}
show={show}
>
<Modal.Body>Are you sure you want to delete this draft?</Modal.Body>
<Modal.Footer>
<Button
variant="secondary"
onClick={closeModal}
>
No
</Button>
<Button
variant="primary"
onClick={onDelete}
>
Yes
</Button>
</Modal.Footer>
</Modal>
)
DeleteDraftModal.propTypes = {
closeModal: PropTypes.func.isRequired,
onDelete: PropTypes.func.isRequired,
show: PropTypes.bool.isRequired
}
export default DeleteDraftModal