diff --git a/src/renderer/components/modal/index.tsx b/src/renderer/components/modal/index.tsx index 8454d3a8..2a00e35d 100644 --- a/src/renderer/components/modal/index.tsx +++ b/src/renderer/components/modal/index.tsx @@ -1,10 +1,16 @@ -import React from 'react'; -import type { ModalProps as MantineModalProps } from '@mantine/core'; -import { Modal as MantineModal } from '@mantine/core'; -import type { ContextModalProps } from '@mantine/modals'; +import React, { ReactNode } from 'react'; +import { + ModalProps as MantineModalProps, + Stack, + Modal as MantineModal, + Flex, + Group, +} from '@mantine/core'; +import { closeAllModals, ContextModalProps } from '@mantine/modals'; +import { Button } from '/@/renderer/components/button'; export interface ModalProps extends Omit { - children?: React.ReactNode; + children?: ReactNode; handlers: { close: () => void; open: () => void; @@ -41,3 +47,44 @@ export const BaseContextModal = ({ Modal.defaultProps = { children: undefined, }; + +interface ConfirmModalProps { + children: ReactNode; + labels?: { + cancel?: string; + confirm?: string; + }; + onCancel?: () => void; + onConfirm: () => void; +} + +export const ConfirmModal = ({ labels, onCancel, onConfirm, children }: ConfirmModalProps) => { + const handleCancel = () => { + if (onCancel) { + onCancel(); + } else { + closeAllModals(); + } + }; + + return ( + + {children} + + + + + + ); +};