| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import React from 'react';
- import { AlertCircle, X } from 'lucide-react';
- import { useLanguage } from '../contexts/LanguageContext';
- interface ConfirmDialogProps {
- isOpen: boolean;
- title?: string;
- message: string;
- confirmLabel?: string;
- cancelLabel?: string;
- onConfirm: () => void;
- onCancel: () => void;
- }
- const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
- isOpen,
- title,
- message,
- confirmLabel,
- cancelLabel,
- onConfirm,
- onCancel,
- }) => {
- const { t } = useLanguage();
- if (!isOpen) return null;
- return (
- <div className="fixed inset-0 z-[10000] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm animate-in fade-in duration-200">
- <div className="bg-white rounded-2xl shadow-2xl w-full max-w-md overflow-hidden animate-in zoom-in duration-200">
- <div className="flex justify-between items-center px-6 py-4 border-b">
- <h3 className="text-lg font-semibold text-slate-800 flex items-center gap-2">
- <AlertCircle className="w-5 h-5 text-amber-500" />
- {title || t('confirmTitle') || 'Confirm'}
- </h3>
- <button
- onClick={onCancel}
- className="text-slate-400 hover:text-slate-600 transition-colors"
- >
- <X size={20} />
- </button>
- </div>
- <div className="px-6 py-8">
- <p className="text-slate-600 whitespace-pre-wrap">{message}</p>
- </div>
- <div className="px-6 py-4 bg-slate-50 flex justify-end gap-3">
- <button
- onClick={onCancel}
- className="px-4 py-2 text-slate-600 hover:bg-slate-200 rounded-xl transition-colors font-medium"
- >
- {cancelLabel || t('cancel') || 'Cancel'}
- </button>
- <button
- onClick={onConfirm}
- className="px-6 py-2 bg-red-600 text-white rounded-xl hover:bg-red-700 transition-colors font-medium shadow-md shadow-red-600/20"
- >
- {confirmLabel || t('confirm') || 'Confirm'}
- </button>
- </div>
- </div>
- </div>
- );
- };
- export default ConfirmDialog;
|