From faf4138d275691ea104d0b54d7157923302c4c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matheus=20Lu=C3=ADs?= Date: Tue, 30 Jan 2024 16:09:37 -0300 Subject: [PATCH] fix: broken dialog component --- package-lock.json | 2 +- package.json | 2 +- src/components/ui/dialog.tsx | 38 +++++++++++++----------------------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9b4917..4c26198 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@radix-ui/react-accordion": "^1.1.1", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-avatar": "^1.0.2", - "@radix-ui/react-dialog": "^1.0.3", + "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.0.4", "@radix-ui/react-hover-card": "^1.0.6", "@radix-ui/react-label": "^2.0.1", diff --git a/package.json b/package.json index ea0db4a..db0209f 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@radix-ui/react-accordion": "^1.1.1", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-avatar": "^1.0.2", - "@radix-ui/react-dialog": "^1.0.3", + "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.0.4", "@radix-ui/react-hover-card": "^1.0.6", "@radix-ui/react-label": "^2.0.1", diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index 32a2a0a..84195eb 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -1,5 +1,3 @@ -'use client'; - import * as DialogPrimitive from '@radix-ui/react-dialog'; import { X } from 'lucide-react'; import * as React from 'react'; @@ -9,30 +7,21 @@ const Dialog = DialogPrimitive.Root; const DialogTrigger = DialogPrimitive.Trigger; -const DialogPortal = ({ - className, - children, - ...props -}: DialogPrimitive.DialogPortalProps) => ( - -
- {children} -
-
-); -DialogPortal.displayName = DialogPrimitive.Portal.displayName; +const DialogPortal = DialogPrimitive.Portal; + +const DialogClose = DialogPrimitive.Close; const DialogOverlay = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; @@ -46,16 +35,15 @@ const DialogContent = React.forwardRef< {children} - + - Closeeeee + Close @@ -68,7 +56,7 @@ const DialogHeader = ({ }: React.HTMLAttributes) => (
(({ className, ...props }, ref) => ( )); @@ -120,6 +107,9 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, + DialogPortal, + DialogOverlay, + DialogClose, DialogTrigger, DialogContent, DialogHeader,