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

46 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 {
isOpen: boolean;
2025-09-22 17:43:55 +00:00
onCancel: () => void;
onConfirm: () => void;
2025-05-05 17:11:44 +00:00
title: React.ReactNode;
description: React.ReactNode;
cancelLabel: React.ReactNode;
confirmLabel: React.ReactNode;
}
export const CustomDialog = ({
isOpen,
onCancel,
onConfirm,
title,
description,
cancelLabel,
confirmLabel,
}: CustomDialogProps) => {
return (
2025-09-22 17:43:55 +00:00
<AlertDialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
2025-05-05 17:11:44 +00:00
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title}</AlertDialogTitle>
<AlertDialogDescription>{description}</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
2025-09-22 17:43:55 +00:00
<AlertDialogCancel onClick={onCancel}>{cancelLabel}</AlertDialogCancel>
<AlertDialogAction onClick={onConfirm}>{confirmLabel}</AlertDialogAction>
2025-05-05 17:11:44 +00:00
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
};