62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import React from 'react';
|
||
import { Modal } from '../ui/Modal';
|
||
import { Button } from '../ui/Button';
|
||
|
||
interface DeleteConfirmModalProps {
|
||
isOpen: boolean;
|
||
onClose: () => void;
|
||
onConfirm: () => void;
|
||
title?: string;
|
||
message?: string;
|
||
warningMessage?: string;
|
||
isLoading?: boolean;
|
||
itemName?: string;
|
||
}
|
||
|
||
export const DeleteConfirmModal: React.FC<DeleteConfirmModalProps> = ({
|
||
isOpen,
|
||
onClose,
|
||
onConfirm,
|
||
title = 'حذف',
|
||
message,
|
||
warningMessage,
|
||
isLoading = false,
|
||
itemName,
|
||
}) => {
|
||
const defaultMessage = itemName
|
||
? `آیا از حذف "${itemName}" اطمینان دارید؟ این عمل قابل بازگشت نیست.`
|
||
: 'آیا از حذف این مورد اطمینان دارید؟ این عمل قابل بازگشت نیست.';
|
||
|
||
return (
|
||
<Modal isOpen={isOpen} onClose={onClose} title={title}>
|
||
<div className="space-y-4">
|
||
<p className="text-gray-600 dark:text-gray-400">
|
||
{message || defaultMessage}
|
||
</p>
|
||
{warningMessage && (
|
||
<p className="text-sm text-red-600 dark:text-red-400">
|
||
{warningMessage}
|
||
</p>
|
||
)}
|
||
<div className="flex justify-end space-x-2 space-x-reverse">
|
||
<Button
|
||
variant="secondary"
|
||
onClick={onClose}
|
||
disabled={isLoading}
|
||
>
|
||
انصراف
|
||
</Button>
|
||
<Button
|
||
variant="danger"
|
||
onClick={onConfirm}
|
||
loading={isLoading}
|
||
>
|
||
حذف
|
||
</Button>
|
||
</div>
|
||
</div>
|
||
</Modal>
|
||
);
|
||
};
|
||
|