Files
dokploy/apps/dokploy/components/shared/dialog-action.tsx
Mauricio Siu 922dcc5de8 chore: biome
2024-09-06 22:41:58 -06:00

46 lines
1020 B
TypeScript

import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
interface Props {
title?: string;
description?: string;
onClick: () => void;
children?: React.ReactNode;
}
export const DialogAction = ({
onClick,
children,
description,
title,
}: 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 onClick={onClick}>Confirm</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
};