File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
next/src/components/Navigation Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,23 @@ export function NavGroup({ group, className }: NavGroupProps) {
38
38
< Link
39
39
href = { group . group . href }
40
40
aria-current = { isActiveGroup ? 'page' : undefined }
41
- className = { lora . className }
41
+ className = { ` ${ lora . className } relative block` }
42
42
>
43
- { group . group . title }
43
+ { group . group . title } { ' ' }
44
+ { group . group . href === router . pathname && (
45
+ < div
46
+ className = { clsx (
47
+ 'absolute' ,
48
+ 'top-[-4px]' ,
49
+ 'bottom-[-4px]' ,
50
+ 'left-[-8px]' ,
51
+ 'right-0' ,
52
+ 'bg-indigo-600/30' ,
53
+ 'dark:bg-white/2.5' ,
54
+ 'rounded-[8px]' ,
55
+ ) }
56
+ />
57
+ ) }
44
58
</ Link >
45
59
</ motion . h2 >
46
60
< div className = "relative mt-3 pl-2" >
@@ -54,6 +68,20 @@ export function NavGroup({ group, className }: NavGroupProps) {
54
68
>
55
69
< NavLink href = { link . href } active = { link . href === router . pathname } >
56
70
{ link . title }
71
+ { link . href === router . pathname && (
72
+ < div
73
+ className = { clsx (
74
+ 'absolute' ,
75
+ 'top-[-4px]' ,
76
+ 'bottom-[-4px]' ,
77
+ 'left-[-16px]' ,
78
+ 'right-0' ,
79
+ 'bg-indigo-600/30' ,
80
+ 'dark:bg-white/2.5' ,
81
+ 'rounded-[8px]' ,
82
+ ) }
83
+ />
84
+ ) }
57
85
</ NavLink >
58
86
< AnimatePresence mode = "popLayout" initial = { false } >
59
87
{ link . href === router . pathname && sections . length > 0 && (
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ function NavLink(
22
22
id = { id }
23
23
aria-current = { active ? 'page' : undefined }
24
24
className = { clsx (
25
- 'flex justify-between gap-2 py-1 pr-3 text-sm transition' ,
25
+ 'relative flex justify-between gap-2 py-1 pr-3 text-sm transition' ,
26
26
isAnchorLink ? 'pl-7' : 'pl-4' ,
27
27
active
28
28
? 'text-zinc-900 dark:text-white'
You can’t perform that action at this time.
0 commit comments