Uecko_ERP/packages/rdx-ui/src/components/custom-dialog.tsx

44 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-05-05 17:11:44 +00:00
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@repo/shadcn-ui/components";
interface CustomDialogProps {
2025-09-23 08:59:15 +00:00
open: boolean;
onConfirm: (ok: boolean) => void;
title?: string;
description?: string;
cancelLabel?: string;
confirmLabel?: string;
2025-05-05 17:11:44 +00:00
}
export const CustomDialog = ({
2025-09-23 08:59:15 +00:00
open,
2025-05-05 17:11:44 +00:00
onConfirm,
title,
description,
cancelLabel,
confirmLabel,
}: CustomDialogProps) => {
return (
2025-09-23 08:59:15 +00:00
<AlertDialog open={open} onOpenChange={(open) => !open && onConfirm(false)}>
2025-05-05 17:11:44 +00:00
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title}</AlertDialogTitle>
<AlertDialogDescription>{description}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
2025-09-23 08:59:15 +00:00
<AlertDialogCancel onClick={() => onConfirm(false)}>{cancelLabel}</AlertDialogCancel>
<AlertDialogAction onClick={() => onConfirm(true)}>{confirmLabel}</AlertDialogAction>
2025-05-05 17:11:44 +00:00
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
};