2020-03-23 02:10:49 +00:00
|
|
|
import React from 'react';
|
2020-03-27 22:32:33 +00:00
|
|
|
import Modal, { RequiredModalProps } from '@/components/elements/Modal';
|
2020-03-23 02:10:49 +00:00
|
|
|
|
2020-03-27 22:32:33 +00:00
|
|
|
type Props = {
|
2020-03-23 02:10:49 +00:00
|
|
|
title: string;
|
|
|
|
buttonText: string;
|
|
|
|
children: string;
|
|
|
|
onConfirmed: () => void;
|
2020-03-27 22:32:33 +00:00
|
|
|
showSpinnerOverlay?: boolean;
|
|
|
|
} & RequiredModalProps;
|
2020-03-23 02:10:49 +00:00
|
|
|
|
2020-03-27 22:32:33 +00:00
|
|
|
const ConfirmationModal = ({ title, appear, children, visible, buttonText, onConfirmed, showSpinnerOverlay, onDismissed }: Props) => (
|
2020-03-23 02:10:49 +00:00
|
|
|
<Modal
|
2020-03-27 22:32:33 +00:00
|
|
|
appear={appear || true}
|
2020-03-23 02:10:49 +00:00
|
|
|
visible={visible}
|
2020-03-27 22:32:33 +00:00
|
|
|
showSpinnerOverlay={showSpinnerOverlay}
|
|
|
|
onDismissed={() => onDismissed()}
|
2020-03-23 02:10:49 +00:00
|
|
|
>
|
|
|
|
<h3 className={'mb-6'}>{title}</h3>
|
|
|
|
<p className={'text-sm'}>{children}</p>
|
|
|
|
<div className={'flex items-center justify-end mt-8'}>
|
2020-03-27 22:32:33 +00:00
|
|
|
<button className={'btn btn-secondary btn-sm'} onClick={() => onDismissed()}>
|
2020-03-23 02:10:49 +00:00
|
|
|
Cancel
|
|
|
|
</button>
|
|
|
|
<button className={'btn btn-red btn-sm ml-4'} onClick={() => onConfirmed()}>
|
|
|
|
{buttonText}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default ConfirmationModal;
|