From 90438060f05c366946fe2ac7f76a6cd20399de13 Mon Sep 17 00:00:00 2001 From: HasithDeAlwis Date: Tue, 19 Nov 2024 12:49:36 -0500 Subject: [PATCH] feat(shadcn/components/ui): add navigation-menu --- .../shadcn/components/ui/navigation-menu.tsx | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 libs/external/shadcn/components/ui/navigation-menu.tsx diff --git a/libs/external/shadcn/components/ui/navigation-menu.tsx b/libs/external/shadcn/components/ui/navigation-menu.tsx new file mode 100644 index 00000000..60bdb1f4 --- /dev/null +++ b/libs/external/shadcn/components/ui/navigation-menu.tsx @@ -0,0 +1,129 @@ +import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu' +import { cva } from 'class-variance-authority' +import { ChevronDown } from 'lucide-react' +import * as React from 'react' +import { cn } from '../../lib/utils' + +const NavigationMenuViewport = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( +
+ +
+)) +NavigationMenuViewport.displayName + = NavigationMenuPrimitive.Viewport.displayName + +const NavigationMenu = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + {children} + + +)) +NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName + +const NavigationMenuList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName + +const NavigationMenuItem = NavigationMenuPrimitive.Item + +const navigationMenuTriggerStyle = cva( + 'group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50', +) + +const NavigationMenuTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + {children} + {' '} + +)) +NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName + +const NavigationMenuContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName + +const NavigationMenuLink = NavigationMenuPrimitive.Link + +const NavigationMenuIndicator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +
+ +)) +NavigationMenuIndicator.displayName + = NavigationMenuPrimitive.Indicator.displayName + +export { + NavigationMenu, + NavigationMenuContent, + NavigationMenuIndicator, + NavigationMenuItem, + NavigationMenuLink, + NavigationMenuList, + NavigationMenuTrigger, + // eslint-disable-next-line react-refresh/only-export-components + navigationMenuTriggerStyle, // generated from shadcn + NavigationMenuViewport, +}