import { AlertTriangle, CheckCircle, XCircle, Info } from 'lucide-react';
import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
export type ModalType = 'confirm' | 'success' | 'error' | 'info';
interface ModalDialogProps {
isOpen: boolean;
title: string;
message?: string;
children?: React.ReactNode;
type?: ModalType;
onConfirm: () => void;
onCancel?: () => void;
confirmText?: string;
cancelText?: string;
isDestructive?: boolean;
}
export default function ModalDialog({
isOpen,
title,
message,
children,
type = 'confirm',
onConfirm,
onCancel,
confirmText,
cancelText,
isDestructive = false
}: ModalDialogProps) {
const { t } = useTranslation();
const finalConfirmText = confirmText || t('common.confirm');
const finalCancelText = cancelText || t('common.cancel');
if (!isOpen) return null;
const getIcon = () => {
switch (type) {
case 'success':
return
{message}
)}