@@ -10,23 +10,31 @@ import MobileMenu from 'components/MobileMenu';
1010interface NavItemProps {
1111 href : string ;
1212 text : string ;
13+ isActive : boolean ;
1314}
1415
15- function NavItem ( { href, text } : NavItemProps ) {
16+ function NavItem ( { href, text, isActive } : NavItemProps ) {
1617 const router = useRouter ( ) ;
17- const isActive = router . asPath === href ;
1818
1919 return (
2020 < NextLink
2121 href = { href }
2222 className = { cn (
2323 isActive
24- ? 'font-semibold text-gray-800 dark:text-gray-200 '
25- : 'font-normal text-gray-600 dark:text-gray-400' ,
26- 'p-1 sm: px-3 sm: py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-800 transition-all text-sm '
24+ ? 'font-medium text-black dark:text-white '
25+ : 'text-gray-600 dark:text-gray-400' ,
26+ 'group inline-block rounded-md px-3 py-2 text-[14px] font-normal transition-colors hover:text-black dark:hover:text-white relative '
2727 ) }
2828 >
29- < span className = "capsize" > { text } </ span >
29+ < span className = "capsize relative z-10" > { text } </ span >
30+ < div
31+ className = { cn (
32+ "absolute inset-0 rounded-md bg-gray-100 dark:bg-gray-800 transition-all duration-300" ,
33+ isActive
34+ ? "opacity-100 scale-100"
35+ : "opacity-0 scale-95 group-hover:opacity-100 group-hover:scale-100"
36+ ) }
37+ />
3038 </ NextLink >
3139 ) ;
3240}
@@ -107,26 +115,27 @@ export default function Container({
107115 < div className = "flex items-center gap-4" >
108116 < button
109117 onClick = { ( ) => setShowQuickLinks ( ! showQuickLinks ) }
110- className = "hidden md:flex items-center justify-between px-3 py-3 rounded-lg bg-gray-200 dark:bg-gray-800 hover:bg -gray-300 dark:hover:bg -gray-700 transition-all font-normal text-gray-600 dark:text-gray-400 text-sm "
118+ className = "group hidden md:flex items-center justify-between px-3 py-2 rounded-md text-[14px] font-normal text -gray-600 dark:text -gray-400 hover: text-black dark:hover: text-white transition-colors relative "
111119 >
112- Quick Links
120+ < span className = "relative z-10" > Quick Links</ span >
113121 < svg
114- className = "w-4 h-4 ml-1"
122+ className = "w-4 h-4 ml-1 relative z-10 "
115123 fill = "none"
116124 stroke = "currentColor"
117125 viewBox = "0 0 24 24"
118126 >
119127 < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M9 5l7 7-7 7" />
120128 </ svg >
129+ < div className = "absolute inset-0 rounded-md bg-gray-100 dark:bg-gray-800 opacity-0 scale-95 transition-all duration-200 group-hover:opacity-100 group-hover:scale-100 pointer-events-none" />
121130 </ button >
122131
123132 < div className = { `${ showQuickLinks ? 'hidden md:flex' : 'hidden' } items-center gap-1` } >
124- < NavItem href = "/" text = "Home" />
125- < NavItem href = "/about" text = "About" />
126- < NavItem href = "/guestbook" text = "Guestbook" />
127- < NavItem href = "/dashboard" text = "Dashboard" />
128- < NavItem href = "/blog" text = "Blog" />
129- < NavItem href = "/snippets" text = "Snippets" />
133+ < NavItem href = "/" text = "Home" isActive = { router . asPath === '/' } />
134+ < NavItem href = "/about" text = "About" isActive = { router . asPath === '/about' } />
135+ < NavItem href = "/guestbook" text = "Guestbook" isActive = { router . asPath === '/guestbook' } />
136+ < NavItem href = "/dashboard" text = "Dashboard" isActive = { router . asPath === '/dashboard' } />
137+ < NavItem href = "/blog" text = "Blog" isActive = { router . asPath === '/blog' } />
138+ < NavItem href = "/snippets" text = "Snippets" isActive = { router . asPath === '/snippets' } />
130139 </ div >
131140 </ div >
132141 </ div >
@@ -135,7 +144,7 @@ export default function Container({
135144 < button
136145 aria-label = "Toggle Dark Mode"
137146 type = "button"
138- className = "w-9 h-9 bg-gray-200 rounded-lg dark:bg-gray-600 flex items-center justify-center hover:ring-2 ring-gray-300 transition-all"
147+ className = "group w-9 h-9 bg-gray-200 rounded-lg dark:bg-gray-600 flex items-center justify-center hover:ring-2 ring-gray-300 transition-all relative "
139148 onClick = { ( ) => setTheme ( resolvedTheme === 'dark' ? 'light' : 'dark' ) }
140149 >
141150 { mounted && (
@@ -144,7 +153,7 @@ export default function Container({
144153 viewBox = "0 0 24 24"
145154 fill = "none"
146155 stroke = "currentColor"
147- className = "w-5 h-5 text-gray-800 dark:text-gray-200"
156+ className = "w-5 h-5 text-gray-800 dark:text-gray-200 relative z-10 "
148157 >
149158 { resolvedTheme === 'dark' ? (
150159 < path
@@ -163,6 +172,7 @@ export default function Container({
163172 ) }
164173 </ svg >
165174 ) }
175+ < div className = "absolute inset-0 rounded-lg bg-gray-300 dark:bg-gray-700 opacity-0 scale-95 transition-all duration-200 group-hover:opacity-100 group-hover:scale-100 pointer-events-none" />
166176 </ button >
167177 </ div >
168178 </ nav >
0 commit comments