2020-05-03 07:05:16 +00:00
|
|
|
import React from 'react';
|
|
|
|
import Modal from 'react-modal';
|
|
|
|
import useModal from 'components/modals/useModal';
|
2019-01-05 06:08:34 +00:00
|
|
|
import Button from 'components/ui/Button';
|
|
|
|
|
2020-05-03 07:05:16 +00:00
|
|
|
const Confirm = () => {
|
|
|
|
const [modal, payload, closeModal] = useModal('confirm');
|
|
|
|
const { question, confirmation, onConfirm } = payload;
|
|
|
|
|
|
|
|
const handleConfirm = () => {
|
|
|
|
closeModal(false);
|
2019-01-05 06:08:34 +00:00
|
|
|
onConfirm();
|
2020-05-03 07:05:16 +00:00
|
|
|
};
|
2019-01-05 06:08:34 +00:00
|
|
|
|
|
|
|
return (
|
2020-05-03 07:05:16 +00:00
|
|
|
<Modal {...modal}>
|
2019-01-05 06:08:34 +00:00
|
|
|
<p>{question}</p>
|
|
|
|
<Button onClick={handleConfirm}>{confirmation || 'OK'}</Button>
|
2020-05-03 07:05:16 +00:00
|
|
|
<Button category="normal" onClick={closeModal}>
|
2019-01-05 06:08:34 +00:00
|
|
|
Cancel
|
|
|
|
</Button>
|
2020-05-03 07:05:16 +00:00
|
|
|
</Modal>
|
2019-01-05 06:08:34 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2020-05-03 07:05:16 +00:00
|
|
|
export default Confirm;
|