From 0f6f5c716c17f399b0224b7fe486e815d9f27826 Mon Sep 17 00:00:00 2001 From: Ryukemeister Date: Tue, 10 Oct 2023 22:35:03 +0530 Subject: [PATCH] setup dialog from shadcn --- packages/atoms/package.json | 1 + packages/atoms/src/components/ui/dialog.tsx | 97 +++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 packages/atoms/src/components/ui/dialog.tsx diff --git a/packages/atoms/package.json b/packages/atoms/package.json index dfc36136bd..54f296e12f 100644 --- a/packages/atoms/package.json +++ b/packages/atoms/package.json @@ -22,6 +22,7 @@ }, "main": "./index", "dependencies": { + "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-slot": "^1.0.2", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", diff --git a/packages/atoms/src/components/ui/dialog.tsx b/packages/atoms/src/components/ui/dialog.tsx new file mode 100644 index 0000000000..6cd31730da --- /dev/null +++ b/packages/atoms/src/components/ui/dialog.tsx @@ -0,0 +1,97 @@ +import { cn } from "@/lib/utils"; +import * as DialogPrimitive from "@radix-ui/react-dialog"; +import { X } from "lucide-react"; +import * as React from "react"; + +const Dialog = DialogPrimitive.Root; + +const DialogTrigger = DialogPrimitive.Trigger; + +const DialogPortal = DialogPrimitive.Portal; + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)); +DialogContent.displayName = DialogPrimitive.Content.displayName; + +const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( +
+); +DialogHeader.displayName = "DialogHeader"; + +const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( +
+); +DialogFooter.displayName = "DialogFooter"; + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogTitle.displayName = DialogPrimitive.Title.displayName; + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogTrigger, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +};