Function
NavLink
({ className, ...props }: ComponentProps<typeof Link>)
Source from the content-addressed store, hash-verified
| 6 | import { ComponentProps } from "react" |
| 7 | |
| 8 | export function NavLink({ className, ...props }: ComponentProps<typeof Link>) { |
| 9 | const path = usePathname() |
| 10 | const isActive = path === props.href |
| 11 | |
| 12 | return ( |
| 13 | <Link |
| 14 | {...props} |
| 15 | className={cn( |
| 16 | "transition-colors", |
| 17 | isActive |
| 18 | ? "text-foreground" |
| 19 | : "text-muted-foreground hover:text-foreground", |
| 20 | className |
| 21 | )} |
| 22 | /> |
| 23 | ) |
| 24 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected