111 files across 14 directories: common, tree-editor, kb-accelerator, copilot, assistant, analytics, library, procedural, procedural-editor, public, script-editor, ui, admin, step-library. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { Modal } from './Modal'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
interface ConfirmDialogProps {
|
|
isOpen: boolean
|
|
onClose: () => void
|
|
onConfirm: () => void
|
|
title: string
|
|
message: string
|
|
confirmLabel?: string
|
|
confirmVariant?: 'destructive' | 'default'
|
|
isLoading?: boolean
|
|
}
|
|
|
|
export function ConfirmDialog({
|
|
isOpen,
|
|
onClose,
|
|
onConfirm,
|
|
title,
|
|
message,
|
|
confirmLabel = 'Delete',
|
|
confirmVariant = 'destructive',
|
|
isLoading = false,
|
|
}: ConfirmDialogProps) {
|
|
return (
|
|
<Modal
|
|
isOpen={isOpen}
|
|
onClose={onClose}
|
|
title={title}
|
|
size="sm"
|
|
footer={
|
|
<div className="flex justify-end gap-3">
|
|
<button
|
|
onClick={onClose}
|
|
disabled={isLoading}
|
|
className={cn(
|
|
'rounded-xl border border-[#1e2130] px-4 py-2 text-sm font-medium',
|
|
'text-[#848b9b] hover:bg-accent hover:text-[#e2e5eb]',
|
|
'disabled:opacity-50 disabled:cursor-not-allowed'
|
|
)}
|
|
>
|
|
Cancel
|
|
</button>
|
|
<button
|
|
onClick={onConfirm}
|
|
disabled={isLoading}
|
|
className={cn(
|
|
'rounded-xl px-4 py-2 text-sm font-medium',
|
|
'disabled:opacity-50 disabled:cursor-not-allowed',
|
|
confirmVariant === 'destructive'
|
|
? 'bg-red-400/10 text-red-400 hover:bg-red-400/20 border border-red-400/20'
|
|
: 'bg-[#22d3ee] text-white hover:brightness-110'
|
|
)}
|
|
>
|
|
{isLoading ? 'Processing...' : confirmLabel}
|
|
</button>
|
|
</div>
|
|
}
|
|
>
|
|
<p className="text-sm text-[#848b9b]">{message}</p>
|
|
</Modal>
|
|
)
|
|
}
|
|
|
|
export default ConfirmDialog
|