46 lines
1022 B
TypeScript
46 lines
1022 B
TypeScript
|
|
"use client";
|
|||
|
|
|
|||
|
|
import { Modal } from "./Modal";
|
|||
|
|
import { Button } from "./Button";
|
|||
|
|
|
|||
|
|
interface ConfirmDialogProps {
|
|||
|
|
open: boolean;
|
|||
|
|
title: string;
|
|||
|
|
description: string;
|
|||
|
|
confirmLabel?: string;
|
|||
|
|
loading?: boolean;
|
|||
|
|
onConfirm: () => void;
|
|||
|
|
onCancel: () => void;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export function ConfirmDialog({
|
|||
|
|
open,
|
|||
|
|
title,
|
|||
|
|
description,
|
|||
|
|
confirmLabel = "حذف کن",
|
|||
|
|
loading,
|
|||
|
|
onConfirm,
|
|||
|
|
onCancel,
|
|||
|
|
}: ConfirmDialogProps) {
|
|||
|
|
return (
|
|||
|
|
<Modal open={open} onClose={onCancel} title={title}>
|
|||
|
|
<p className="text-[14px] text-(--color-content-secondary) leading-6 mb-6">
|
|||
|
|
{description}
|
|||
|
|
</p>
|
|||
|
|
<div className="flex gap-2 justify-end">
|
|||
|
|
<Button variant="ghost" size="sm" onClick={onCancel}>
|
|||
|
|
انصراف
|
|||
|
|
</Button>
|
|||
|
|
<Button
|
|||
|
|
size="sm"
|
|||
|
|
isLoading={loading}
|
|||
|
|
className="!bg-(--color-status-error) !shadow-none hover:!bg-red-700"
|
|||
|
|
onClick={onConfirm}
|
|||
|
|
>
|
|||
|
|
{confirmLabel}
|
|||
|
|
</Button>
|
|||
|
|
</div>
|
|||
|
|
</Modal>
|
|||
|
|
);
|
|||
|
|
}
|