feat : remove dupe code of codition code
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"use client";
|
||||
|
||||
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) {
|
||||
return (
|
||||
<DeleteConfirmationDialog
|
||||
trigger={trigger}
|
||||
triggerTooltip={iconOnly ? "ลบ Condition นี้" : undefined}
|
||||
title="ลบ Condition นี้?"
|
||||
description="ข้อมูลทั้งหมดใน Condition นี้จะถูกลบออก"
|
||||
showSuccessToast
|
||||
onConfirm={onConfirm}
|
||||
>
|
||||
<Trash2Icon data-icon={iconOnly ? undefined : "inline-start"} />
|
||||
<span className={iconOnly ? "sr-only" : undefined}>ลบ Condition นี้</span>
|
||||
</DeleteConfirmationDialog>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user