@@ -13,9 +13,9 @@ import { ErrorBoundary } from 'react-error-boundary'
13
13
import { getApiNavigation } from '@/lib/content' ;
14
14
import { useAnalytics } from '@/hooks/useAnalytics' ;
15
15
const buttonStyles = {
16
- base : "w-full justify-start text-left font-normal rounded-lg transition-all px-3 py-2 whitespace-normal" ,
16
+ base : "w-full justify-start text-left font-normal rounded-lg transition-all px-1.5 py-1 whitespace-normal break-words " ,
17
17
hover : "hover:bg-accent/40 hover:text-accent-foreground" ,
18
- active : "bg-gradient-to-r from-accent to-accent/80 text-accent-foreground font-medium shadow-md translate-x-1" ,
18
+ active : "w-full bg-gradient-to-r from-accent to-accent/80 text-accent-foreground font-medium shadow-md translate-x-1 px-1.5 py-1 break-words " ,
19
19
state : "data-[state=open]:bg-accent/30" ,
20
20
}
21
21
@@ -88,7 +88,7 @@ const NavItem = React.memo(({ locale, item, pathname, depth = 0 }: NavItemProps)
88
88
< motion . div
89
89
ref = { itemRef }
90
90
className = { cn (
91
- "relative" ,
91
+ "relative mb-1 " ,
92
92
depth > 0 && "ml-3 border-l border-border/50 pl-3 before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-gradient-to-b before:from-border/0 before:via-border/50 before:to-border/0"
93
93
) }
94
94
initial = { { opacity : 0 , x : - 20 } }
@@ -103,29 +103,34 @@ const NavItem = React.memo(({ locale, item, pathname, depth = 0 }: NavItemProps)
103
103
buttonStyles . state ,
104
104
isActive && buttonStyles . active ,
105
105
depth > 0 && "text-sm text-muted-foreground" ,
106
- "group"
106
+ "group flex items-start gap-2" ,
107
+ "min-h-[2.5rem] h-auto"
107
108
) }
108
109
onClick = { handleClick }
109
110
>
110
- { hasChildren ? (
111
+ { hasChildren && (
111
112
< motion . div
112
- className = "text-muted-foreground/70 group-hover:text-muted-foreground"
113
+ className = "text-muted-foreground/70 group-hover:text-muted-foreground shrink-0 mt-1 "
113
114
initial = { false }
114
115
animate = { { rotate : isOpen ? 90 : 0 } }
115
116
transition = { { duration : 0.2 } }
116
117
>
117
- < ChevronRight className = "mr-2 h-3.5 w-3.5" />
118
+ < ChevronRight className = "h-3.5 w-3.5" />
118
119
</ motion . div >
119
- ) : "" }
120
+ ) }
120
121
{ item . path ? (
121
- < Link href = { absolutePath } className = "flex-1 break-words" onClick = { handleClick } >
122
- { item . title }
122
+ < Link
123
+ href = { absolutePath }
124
+ className = "flex-1 leading-tight py-0.5"
125
+ onClick = { handleClick }
126
+ >
127
+ < span className = "inline-block" > { item . title } </ span >
123
128
</ Link >
124
129
) : (
125
- < span className = "flex-1 break-words " > { item . title } </ span >
130
+ < span className = "flex-1 leading-tight py-0.5 inline-block " > { item . title } </ span >
126
131
) }
127
132
{ item . badge && (
128
- < span className = "ml-2 px-2 py-0.5 text-xs rounded-full bg-accent text-accent-foreground shrink-0" >
133
+ < span className = "px-2 py-0.5 text-xs rounded-full bg-accent text-accent-foreground shrink-0 self-start mt-1 " >
129
134
{ item . badge }
130
135
</ span >
131
136
) }
@@ -137,6 +142,7 @@ const NavItem = React.memo(({ locale, item, pathname, depth = 0 }: NavItemProps)
137
142
animate = { { opacity : 1 , height : "auto" } }
138
143
exit = { { opacity : 0 , height : 0 } }
139
144
transition = { { duration : 0.3 , ease : "easeInOut" } }
145
+ className = "mt-1"
140
146
>
141
147
{ Object . entries ( item . items ! ) . map ( ( [ key , child ] ) => (
142
148
< NavItem locale = { locale } key = { key } item = { child } pathname = { pathname } depth = { depth + 1 } />
0 commit comments