40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { AlertCircle } from 'lucide-react';
|
|
import React from 'react';
|
|
|
|
interface DeleteConfirmationProps {
|
|
item: any | null;
|
|
onConfirm: () => Promise<void>;
|
|
onCancel: () => void;
|
|
}
|
|
|
|
export function DeleteConfirmation({ item, onConfirm, onCancel }: DeleteConfirmationProps) {
|
|
const handleConfirm = React.useCallback(async () => {
|
|
await onConfirm();
|
|
// Auto-close after confirmation by calling onCancel to dismiss overlay
|
|
}, [onConfirm]);
|
|
|
|
return (
|
|
<div className="delete-modal-overlay" onClick={onCancel}>
|
|
<div className="delete-modal-content" onClick={(e) => e.stopPropagation()}>
|
|
<div className="warning-icon">
|
|
<AlertCircle size={48} color="#dc2626" />
|
|
</div>
|
|
<h3>Are you sure you want to delete "{item?.title || 'this item'}"?</h3>
|
|
<p>This action cannot be undone and will permanently remove the content from the system.</p>
|
|
|
|
<div className="modal-actions">
|
|
<button onClick={onCancel} className="btn-secondary">
|
|
Cancel
|
|
</button>
|
|
<button
|
|
onClick={handleConfirm}
|
|
className="btn-danger"
|
|
>
|
|
Yes, Delete
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|