/** * ConfirmDialog 组件 * * 确认对话框组件 * 基于 Modal 组件构建,用于需要用户确认的操作 * 支持多种变体(default、danger)和加载状态 * * @created 2025-11-22 * @component */ 'use client' import { ReactNode } from 'react' import Modal from './Modal' import { useThemeStyles, cn } from '@/lib/ui-styles' interface ConfirmDialogProps { isOpen: boolean onClose: () => void onConfirm: () => void title: string message: string | ReactNode confirmText?: string cancelText?: string variant?: 'default' | 'danger' loading?: boolean } export default function ConfirmDialog({ isOpen, onClose, onConfirm, title, message, confirmText = '确认', cancelText = '取消', variant = 'default', loading = false, }: ConfirmDialogProps) { const styles = useThemeStyles() const handleConfirm = () => { if (!loading) { onConfirm() } } return ( } >
{typeof message === 'string' ? (

{message}

) : ( message )}
) }