From e9fae3a61ae2b3f84b29a673a957dd15e58e6a06 Mon Sep 17 00:00:00 2001 From: lukaw3d Date: Tue, 18 Apr 2023 04:32:27 +0200 Subject: [PATCH] Move ModalContainer into its own file --- src/app/components/Modal/ModalContainer.tsx | 55 ++++++++++++++++++ src/app/components/Modal/index.tsx | 62 ++------------------- 2 files changed, 59 insertions(+), 58 deletions(-) create mode 100644 src/app/components/Modal/ModalContainer.tsx diff --git a/src/app/components/Modal/ModalContainer.tsx b/src/app/components/Modal/ModalContainer.tsx new file mode 100644 index 0000000000..595ab48960 --- /dev/null +++ b/src/app/components/Modal/ModalContainer.tsx @@ -0,0 +1,55 @@ +import { useCallback } from 'react' +import { Box } from 'grommet/es6/components/Box' +import { Button } from 'grommet/es6/components/Button' +import { Layer } from 'grommet/es6/components/Layer' +import { Paragraph } from 'grommet/es6/components/Paragraph' +import { useTranslation } from 'react-i18next' +import { Alert } from 'grommet-icons/es6/icons/Alert' +import { Checkmark } from 'grommet-icons/es6/icons/Checkmark' +import { Close } from 'grommet-icons/es6/icons/Close' +import { ModalHeader } from 'app/components/Header' + +export interface Modal { + title: string + description: string + handleConfirm: () => void + isDangerous: boolean +} + +interface ModalContainerProps { + modal: Modal + closeModal: () => void +} + +export const ModalContainer = ({ modal, closeModal }: ModalContainerProps) => { + const { t } = useTranslation() + const confirm = useCallback(() => { + modal.handleConfirm() + closeModal() + }, [closeModal, modal]) + + return ( + + + {modal.title} + {modal.description} + +