import type { ReactNode } from 'react'; import { useTransition } from 'react'; import { Button } from '../button/Button'; import { ModalBody, ModalFooter, ModalHeader, ModalRoot } from './Modal'; interface ConfirmModalProps { isOpen?: boolean; onOpenChange?: (isOpen: boolean) => void; title?: string; content?: ReactNode; confirmText?: string; cancelText?: string; onConfirm?: () => Promise | void; onCancel?: () => void; } export const ConfirmModal = (props: ConfirmModalProps) => { const { isOpen, onOpenChange, title, ...contentProps } = props; return ( {({ close }) => } ); }; function ConfirmModalContent({ close, title, content, confirmText = '확인', cancelText = '취소', onConfirm, onCancel, }: { close: () => void; title?: string; content?: ReactNode; confirmText?: string; cancelText?: string; onConfirm?: () => Promise | void; onCancel?: () => void; }) { const [isPending, startTransition] = useTransition(); const handleConfirm = () => { if (onConfirm) { startTransition(async () => { await onConfirm(); close(); }); } else { close(); } }; const handleCancel = () => { onCancel?.(); close(); }; return ( <> {title && {title}}

{content}

); }