Files
dokploy/apps/dokploy/components/shared/dialog-action.tsx

50 lines
1.1 KiB
TypeScript

import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
interface Props {
title?: string | React.ReactNode;
description?: string | React.ReactNode;
onClick: () => void;
children?: React.ReactNode;
disabled?: boolean;
}
export const DialogAction = ({
onClick,
children,
description,
title,
disabled,
}: Props) => {
return (
<AlertDialog>
<AlertDialogTrigger asChild>{children}</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
{title ?? "Are you absolutely sure?"}
</AlertDialogTitle>
<AlertDialogDescription>
{description ?? "This action cannot be undone."}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction disabled={disabled} onClick={onClick}>
Confirm
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
};