import React, { useContext, useEffect } from 'react'; import tw from 'twin.macro'; import Button from '@/components/elements/Button'; import asModal from '@/hoc/asModal'; import ModalContext from '@/context/ModalContext'; type Props = { title: string; buttonText: string; children: string; onConfirmed: () => void; showSpinnerOverlay?: boolean; }; const ConfirmationModal = ({ title, children, buttonText, onConfirmed, showSpinnerOverlay }: Props) => { const { dismiss, toggleSpinner } = useContext(ModalContext); useEffect(() => { toggleSpinner(showSpinnerOverlay); }, [ showSpinnerOverlay ]); return ( <>

{title}

{children}

); }; ConfirmationModal.displayName = 'ConfirmationModal'; export default asModal()(ConfirmationModal);