From 9695c29ab56bf812d02729132529422b85c2c23c Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Sat, 15 Mar 2025 19:56:57 +0100 Subject: [PATCH] Add reusable Dialog component using Radix UI Implemented a Dialog component with Radix UI's primitives for a customizable and accessible modal experience. Updated dependencies to include `@radix-ui/react-dialog` and structured the component for extensibility and reuse. --- frontend/package-lock.json | 1 + frontend/package.json | 1 + frontend/src/components/ui/dialog.tsx | 135 ++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 frontend/src/components/ui/dialog.tsx diff --git a/frontend/package-lock.json b/frontend/package-lock.json index cea8e2d..dc1dde5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,6 +11,7 @@ "@hey-api/client-axios": "^0.6.2", "@hey-api/client-fetch": "^0.8.3", "@radix-ui/react-alert-dialog": "^1.1.6", + "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-label": "^2.1.2", "@radix-ui/react-popover": "^1.1.6", "@radix-ui/react-progress": "^1.1.2", diff --git a/frontend/package.json b/frontend/package.json index 894aaaf..0130924 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,6 +16,7 @@ "@hey-api/client-axios": "^0.6.2", "@hey-api/client-fetch": "^0.8.3", "@radix-ui/react-alert-dialog": "^1.1.6", + "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-label": "^2.1.2", "@radix-ui/react-popover": "^1.1.6", "@radix-ui/react-progress": "^1.1.2", diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/ui/dialog.tsx new file mode 100644 index 0000000..7d7a9d3 --- /dev/null +++ b/frontend/src/components/ui/dialog.tsx @@ -0,0 +1,135 @@ +"use client" + +import * as React from "react" +import * as DialogPrimitive from "@radix-ui/react-dialog" +import { XIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +function Dialog({ + ...props +}: React.ComponentProps) { + return +} + +function DialogTrigger({ + ...props +}: React.ComponentProps) { + return +} + +function DialogPortal({ + ...props +}: React.ComponentProps) { + return +} + +function DialogClose({ + ...props +}: React.ComponentProps) { + return +} + +function DialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function DialogContent({ + className, + children, + ...props +}: React.ComponentProps) { + return ( + + + + {children} + + + Close + + + + ) +} + +function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function DialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function DialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +export { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogOverlay, + DialogPortal, + DialogTitle, + DialogTrigger, +}