-
Notifications
You must be signed in to change notification settings - Fork 0
fix: change navbar links to shadcn navigation menu components #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ import * as React from "react"; | |
| import { cn } from "@repo/ui/lib/utils"; | ||
|
|
||
| const NavigationMenu = React.forwardRef< | ||
| React.ElementRef<typeof NavigationMenuPrimitive.Root>, | ||
| React.ComponentRef<typeof NavigationMenuPrimitive.Root>, | ||
| React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root> | ||
|
Comment on lines
+10
to
11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainRef type regression: use React.ElementRef, not React.ComponentRef, for Radix primitives.
Apply: - React.ComponentRef<typeof NavigationMenuPrimitive.Root>,
+ React.ElementRef<typeof NavigationMenuPrimitive.Root>,
@@
- React.ComponentRef<typeof NavigationMenuPrimitive.List>,
+ React.ElementRef<typeof NavigationMenuPrimitive.List>,
@@
- React.ComponentRef<typeof NavigationMenuPrimitive.Trigger>,
+ React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
@@
- React.ComponentRef<typeof NavigationMenuPrimitive.Content>,
+ React.ElementRef<typeof NavigationMenuPrimitive.Content>,
@@
- React.ComponentRef<typeof NavigationMenuPrimitive.Viewport>,
+ React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
@@
- React.ComponentRef<typeof NavigationMenuPrimitive.Indicator>,
+ React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,Run a quick TS check to ensure refs are typed correctly: Expect: no matches. Also applies to: 28-29, 49-51, 67-69, 84-86, 102-104 🏁 Script executed: #!/bin/bash
rg -nP 'forwardRef<\s*React\.ComponentRef<' -g 'packages/ui/**.tsx' -SLength of output: 148 🏁 Script executed: #!/bin/bash
# Search for any usage of React.ComponentRef across all .tsx files
rg -nP 'React\.ComponentRef<' -t tsx -n
# Specifically look for forwardRef generics using React.ComponentRef
rg -nP 'forwardRef<\s*React\.ComponentRef<' -t tsx -n -C3Length of output: 55 🏁 Script executed: #!/bin/bash
# Search for any usage of React.ComponentRef in .tsx files by glob pattern
rg -nP 'React\.ComponentRef<' -g '*.tsx' -n
# Search for forwardRef generics explicitly using React.ComponentRef
rg -nP 'forwardRef<\s*React\.ComponentRef<' -g '*.tsx' -n -C3Length of output: 705 Replace React.ComponentRef with React.ElementRef for Radix primitives 🤖 Prompt for AI Agents |
||
| >(({ className, children, ...props }, ref) => ( | ||
| <NavigationMenuPrimitive.Root | ||
|
|
@@ -25,7 +25,7 @@ const NavigationMenu = React.forwardRef< | |
| NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName; | ||
|
|
||
| const NavigationMenuList = React.forwardRef< | ||
| React.ElementRef<typeof NavigationMenuPrimitive.List>, | ||
| React.ComponentRef<typeof NavigationMenuPrimitive.List>, | ||
| React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List> | ||
| >(({ className, ...props }, ref) => ( | ||
| <NavigationMenuPrimitive.List | ||
|
|
@@ -46,7 +46,7 @@ const navigationMenuTriggerStyle = cva( | |
| ); | ||
|
|
||
| const NavigationMenuTrigger = React.forwardRef< | ||
| React.ElementRef<typeof NavigationMenuPrimitive.Trigger>, | ||
| React.ComponentRef<typeof NavigationMenuPrimitive.Trigger>, | ||
| React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger> | ||
| >(({ className, children, ...props }, ref) => ( | ||
| <NavigationMenuPrimitive.Trigger | ||
|
|
@@ -64,7 +64,7 @@ const NavigationMenuTrigger = React.forwardRef< | |
| NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName; | ||
|
|
||
| const NavigationMenuContent = React.forwardRef< | ||
| React.ElementRef<typeof NavigationMenuPrimitive.Content>, | ||
| React.ComponentRef<typeof NavigationMenuPrimitive.Content>, | ||
| React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content> | ||
| >(({ className, ...props }, ref) => ( | ||
| <NavigationMenuPrimitive.Content | ||
|
|
@@ -81,7 +81,7 @@ NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName; | |
| const NavigationMenuLink = NavigationMenuPrimitive.Link; | ||
|
|
||
| const NavigationMenuViewport = React.forwardRef< | ||
| React.ElementRef<typeof NavigationMenuPrimitive.Viewport>, | ||
| React.ComponentRef<typeof NavigationMenuPrimitive.Viewport>, | ||
| React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport> | ||
| >(({ className, ...props }, ref) => ( | ||
| <div className={cn("absolute left-0 top-full flex justify-center")}> | ||
|
|
@@ -99,7 +99,7 @@ NavigationMenuViewport.displayName = | |
| NavigationMenuPrimitive.Viewport.displayName; | ||
|
|
||
| const NavigationMenuIndicator = React.forwardRef< | ||
| React.ElementRef<typeof NavigationMenuPrimitive.Indicator>, | ||
| React.ComponentRef<typeof NavigationMenuPrimitive.Indicator>, | ||
| React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator> | ||
| >(({ className, ...props }, ref) => ( | ||
| <NavigationMenuPrimitive.Indicator | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Typo and client-side navigation regression on “Become an author” link.
Fix by using
asChildand wrapping Next.jsLink.Apply:
If the canonical route is different (e.g.,
/become-an-author), adjust accordingly.🏁 Script executed:
Length of output: 67
🏁 Script executed:
Length of output: 1576
Fix “Become an author” link: correct typo and enable client-side routing
/become-autherto/become-author(or your canonical route).<Link>usingNavigationMenuLink asChildto preserve prefetch and client-side navigation.📝 Committable suggestion
🤖 Prompt for AI Agents