From 0f6efb97698a997c5467eecb8cfed571305f9676 Mon Sep 17 00:00:00 2001 From: JEM Date: Thu, 13 Mar 2025 06:03:20 -0500 Subject: [PATCH] fix(navigation-menu v4): 6888 - Remove "use client" directive (#6913) Removes unnecessary "use client" directive from navigation menu components to simplify the code and avoid potential issues. Co-authored-by: shadcn --- apps/v4/components/navigation-menu-demo.tsx | 2 -- apps/v4/registry/new-york-v4/ui/navigation-menu.tsx | 2 -- apps/www/public/r/styles/new-york-v4/navigation-menu.json | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/v4/components/navigation-menu-demo.tsx b/apps/v4/components/navigation-menu-demo.tsx index bd41abc98f..115cd5ef25 100644 --- a/apps/v4/components/navigation-menu-demo.tsx +++ b/apps/v4/components/navigation-menu-demo.tsx @@ -1,5 +1,3 @@ -"use client" - import * as React from "react" import Link from "next/link" import { CircleCheckIcon, CircleHelpIcon, CircleIcon } from "lucide-react" diff --git a/apps/v4/registry/new-york-v4/ui/navigation-menu.tsx b/apps/v4/registry/new-york-v4/ui/navigation-menu.tsx index 9ca1f05c6a..431e5c92e7 100644 --- a/apps/v4/registry/new-york-v4/ui/navigation-menu.tsx +++ b/apps/v4/registry/new-york-v4/ui/navigation-menu.tsx @@ -1,5 +1,3 @@ -"use client" - import * as React from "react" import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu" import { cva } from "class-variance-authority" diff --git a/apps/www/public/r/styles/new-york-v4/navigation-menu.json b/apps/www/public/r/styles/new-york-v4/navigation-menu.json index 436be7a33a..4086720902 100644 --- a/apps/www/public/r/styles/new-york-v4/navigation-menu.json +++ b/apps/www/public/r/styles/new-york-v4/navigation-menu.json @@ -8,7 +8,7 @@ "files": [ { "path": "registry/new-york-v4/ui/navigation-menu.tsx", - "content": "\"use client\"\n\nimport * as React from \"react\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\nimport { cva } from \"class-variance-authority\"\nimport { ChevronDownIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction NavigationMenu({\n className,\n children,\n viewport = true,\n ...props\n}: React.ComponentProps & {\n viewport?: boolean\n}) {\n return (\n \n {children}\n {viewport && }\n \n )\n}\n\nfunction NavigationMenuList({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction NavigationMenuItem({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nconst navigationMenuTriggerStyle = cva(\n \"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1\"\n)\n\nfunction NavigationMenuTrigger({\n className,\n children,\n ...props\n}: React.ComponentProps) {\n return (\n \n {children}{\" \"}\n \n \n )\n}\n\nfunction NavigationMenuContent({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction NavigationMenuViewport({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n \n \n )\n}\n\nfunction NavigationMenuLink({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction NavigationMenuIndicator({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n
\n \n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuContent,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuViewport,\n navigationMenuTriggerStyle,\n}\n", + "content": "import * as React from \"react\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\nimport { cva } from \"class-variance-authority\"\nimport { ChevronDownIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction NavigationMenu({\n className,\n children,\n viewport = true,\n ...props\n}: React.ComponentProps & {\n viewport?: boolean\n}) {\n return (\n \n {children}\n {viewport && }\n \n )\n}\n\nfunction NavigationMenuList({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction NavigationMenuItem({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nconst navigationMenuTriggerStyle = cva(\n \"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1\"\n)\n\nfunction NavigationMenuTrigger({\n className,\n children,\n ...props\n}: React.ComponentProps) {\n return (\n \n {children}{\" \"}\n \n \n )\n}\n\nfunction NavigationMenuContent({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction NavigationMenuViewport({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n \n
\n )\n}\n\nfunction NavigationMenuLink({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n )\n}\n\nfunction NavigationMenuIndicator({\n className,\n ...props\n}: React.ComponentProps) {\n return (\n \n
\n \n )\n}\n\nexport {\n NavigationMenu,\n NavigationMenuList,\n NavigationMenuItem,\n NavigationMenuContent,\n NavigationMenuTrigger,\n NavigationMenuLink,\n NavigationMenuIndicator,\n NavigationMenuViewport,\n navigationMenuTriggerStyle,\n}\n", "type": "registry:ui" } ]