36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { useTranslation } from "@/components/i18n/locale-provider";
|
|
import type { ComponentProps } from "react";
|
|
import { Trash2Icon } from "lucide-react";
|
|
|
|
import { DeleteConfirmationDialog } from "@/components/admin/delete-confirmation-dialog";
|
|
|
|
type DeleteConditionDialogProps = Pick<
|
|
ComponentProps<typeof DeleteConfirmationDialog>,
|
|
"trigger" | "onConfirm"
|
|
> & {
|
|
iconOnly?: boolean;
|
|
};
|
|
|
|
export function DeleteConditionDialog({
|
|
trigger,
|
|
onConfirm,
|
|
iconOnly = false,
|
|
}: DeleteConditionDialogProps) {
|
|
const { t } = useTranslation();
|
|
return (
|
|
<DeleteConfirmationDialog
|
|
trigger={trigger}
|
|
triggerTooltip={iconOnly ? t("ลบ Condition นี้") : undefined}
|
|
title={t("ลบ Condition นี้?")}
|
|
description={t("ข้อมูลทั้งหมดใน Condition นี้จะถูกลบออก")}
|
|
showSuccessToast
|
|
onConfirm={onConfirm}
|
|
>
|
|
<Trash2Icon data-icon={iconOnly ? undefined : "inline-start"} />
|
|
<span className={iconOnly ? "sr-only" : undefined}>{t("ลบ Condition นี้")}</span>
|
|
</DeleteConfirmationDialog>
|
|
);
|
|
}
|