'use client'; import { AlertTriangle, X } from 'lucide-react'; import { createPortal } from 'react-dom'; interface ConfirmDialogProps { isOpen: boolean; title: string; message: string; confirmText?: string; cancelText?: string; onConfirm: () => void; onCancel: () => void; variant?: 'danger' | 'warning' | 'info'; } export function ConfirmDialog({ isOpen, title, message, confirmText = '确定', cancelText = '取消', onConfirm, onCancel, variant = 'warning', }: ConfirmDialogProps) { if (!isOpen) return null; const variantStyles = { danger: { icon: 'text-red-500', button: 'bg-red-500 hover:bg-red-600', }, warning: { icon: 'text-yellow-500', button: 'bg-yellow-500 hover:bg-yellow-600', }, info: { icon: 'text-blue-500', button: 'bg-blue-500 hover:bg-blue-600', }, }; const styles = variantStyles[variant]; return createPortal(
{message}