Skip to content

Commit

Permalink
fix: viewportalclassname on nav menu
Browse files Browse the repository at this point in the history
  • Loading branch information
nahoc committed Aug 19, 2024
1 parent 7154028 commit e9b0141
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { cn } from "./cn";

const NavigationMenu = forwardRef<
ElementRef<typeof NavigationMenuPrimitive.Root>,
ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
>(({ className, children, ...props }, ref) => (
ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root> & {
viewPortClassName?: string;
}
>(({ className, children, viewPortClassName, ...props }, ref) => (
<NavigationMenuPrimitive.Root
ref={ref}
className={cn("relative z-10 flex max-w-max flex-1 items-center justify-center", className)}
{...props}
>
{children}
<NavigationMenuViewport />
<NavigationMenuViewport className={viewPortClassName} />
</NavigationMenuPrimitive.Root>
));

Expand Down Expand Up @@ -71,7 +73,7 @@ const NavigationMenuViewport = forwardRef<
<div className={cn("absolute top-full left-0 flex justify-center")}>
<NavigationMenuPrimitive.Viewport
className={cn(
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full origin-top-center overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=closed]:animate-out data-[state=open]:animate-in md:w-[var(--radix-navigation-menu-viewport-width)]",
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full origin-top-center overflow-hidden rounded-md border bg-popover text-popover-foreground data-[state=closed]:animate-out data-[state=open]:animate-in md:w-[var(--radix-navigation-menu-viewport-width)]",
className,
)}
ref={ref}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@risc0/ui",
"version": "0.0.154",
"version": "0.0.155",
"private": false,
"sideEffects": false,
"type": "module",
Expand Down Expand Up @@ -37,7 +37,7 @@
"clsx": "2.1.1",
"cmdk": "1.0.0",
"lucide-react": "0.428.0",
"next": "15.0.0-canary.118",
"next": "15.0.0-canary.120",
"next-themes": "0.3.0",
"radash": "12.1.0",
"react-hook-form": "7.52.2",
Expand All @@ -48,7 +48,7 @@
"tailwind-merge": "2.5.2",
"tailwindcss": "3.4.10",
"tailwindcss-animate": "1.0.7",
"typescript": "5.6.0-dev.20240816",
"typescript": "5.6.0-dev.20240819",
"vaul": "0.9.1"
},
"devDependencies": {
Expand Down

0 comments on commit e9b0141

Please sign in to comment.