We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7030a40 commit a895ba3Copy full SHA for a895ba3
resources/js/components/nav-main.tsx
@@ -1,5 +1,5 @@
1
import { type NavItemType } from '@/types'
2
-import { Link } from "@inertiajs/react"
+import { Link, usePage } from "@inertiajs/react"
3
import {
4
SidebarGroup,
5
SidebarMenu,
@@ -10,12 +10,13 @@ import {
10
export function NavMain({ items = [] }: {
11
items: NavItemType[]
12
}) {
13
+ const page = usePage();
14
return (
15
<SidebarGroup>
16
<SidebarMenu>
17
{items.map((item) => (
18
<SidebarMenuItem key={item.title}>
- <SidebarMenuButton asChild isActive={item.isActive}>
19
+ <SidebarMenuButton asChild isActive={item.url === page.url}>
20
<Link href={item.url} prefetch>
21
<item.icon />
22
<span>{item.title}</span>
0 commit comments