'use client' import * as React from 'react' import { Loader2 } from 'lucide-react' import { BaseDialog } from './BaseDialog' import { Button } from '../ui/button' export interface ConfirmDialogProps { open: boolean onClose: () => void onConfirm: () => void | Promise title: string description?: string | React.ReactNode confirmLabel?: string cancelLabel?: string destructive?: boolean loading?: boolean } export function ConfirmDialog({ open, onClose, onConfirm, title, description, confirmLabel = 'Confirm', cancelLabel = 'Cancel', destructive = false, loading = false, }: ConfirmDialogProps) { const handleClose = () => { if (loading) return onClose() } return ( { if (!o) handleClose() }} size="sm" loading={loading} > {title} {description && ( {typeof description === 'string' ? (

{description}

) : ( description )}
)}
) }