@@ -31,8 +31,15 @@ const {
3131 <div
3232 class =" hidden items-center gap-6 place-self-center text-xs sm:text-sm lg:flex lg:text-base"
3333 >
34+ <a
35+ class ={ ` hidden items-center hover:bg-muted rounded-lg p-3 lg:block${Astro .url .pathname === getLocalePath (' /' ) ? ' text-coral' : ' ' } ` }
36+ href ={ getLocalePath (' /' )}
37+ >
38+ <span >{ menu .home } </span >
39+ </a >
40+
3441 <Dropdown class =" group" >
35- <button class =" flex items-center" >
42+ <button class =" flex items-center rounded-lg p-3 hover:bg-muted group-open:bg-muted " >
3643 <span >{ menu .gettingStarted } </span >
3744 <ChevronDownIcon
3845 class =" size-4 transform transition-transform duration-200 group-open:rotate-180 md:ml-2"
@@ -66,7 +73,7 @@ const {
6673 </DropdownItems >
6774 </Dropdown >
6875 <Dropdown class =" group" >
69- <button class =" flex items-center" >
76+ <button class =" flex items-center rounded-lg p-3 hover:bg-muted group-open:bg-muted " >
7077 <span >{ menu .usefulLinks } </span >
7178 <ChevronDownIcon
7279 class =" size-4 transform transition-transform duration-200 group-open:rotate-180 md:ml-2"
@@ -80,12 +87,6 @@ const {
8087 { menu .donateDesc }
8188 </div >
8289 </a >
83- <a class =" dropdown-item" href ={ getLocalePath (' /about' )} >
84- <div class =" dropdown-title" >{ menu .aboutUs } </div >
85- <div class =" dropdown-description" >
86- { menu .aboutUsDesc }
87- </div >
88- </a >
8990 <a class =" dropdown-item" href =" https://docs.zen-browser.app" >
9091 <div class =" dropdown-title" >{ menu .documentation } </div >
9192 <div class =" dropdown-description" >
@@ -101,7 +102,16 @@ const {
101102 </div >
102103 </DropdownItems >
103104 </Dropdown >
104- <a class =" hidden items-center lg:block" href ={ getLocalePath (' /mods' )} >
105+ <a
106+ class ={ ` hidden items-center hover:bg-muted rounded-lg p-3 lg:block${Astro .url .pathname === getLocalePath (' /about' ) ? ' text-coral' : ' ' } ` }
107+ href ={ getLocalePath (' /about' )}
108+ >
109+ <span >{ menu .aboutUs } </span >
110+ </a >
111+ <a
112+ class ={ ` hidden items-center hover:bg-muted rounded-lg p-3 lg:block${Astro .url .pathname === getLocalePath (' /mods' ) ? ' text-coral' : ' ' } ` }
113+ href ={ getLocalePath (' /mods' )}
114+ >
105115 <span >{ menu .mods } </span >
106116 </a >
107117 </div >
@@ -135,7 +145,7 @@ const {
135145
136146<style >
137147 .navbar-dropdown {
138- @apply absolute left-1/2 mt-2 grid !-translate-x-1/2 !transform grid-cols-2 gap-2 rounded-lg border-2 border-dark bg-paper p-3 shadow-sm ;
148+ @apply absolute left-1/2 mt-2 grid !-translate-x-1/2 !transform grid-cols-2 gap-2 rounded-lg border border-dark bg-paper p-3 shadow-lg ;
139149 & .dropdown-item {
140150 @apply flex cursor-pointer select-none flex-col gap-2 rounded-lg p-4 transition-colors duration-200;
141151
@@ -158,3 +168,48 @@ const {
158168 @apply text-dark;
159169 }
160170</style >
171+ <script >
172+ import { animate, stagger } from 'animejs'
173+
174+ function animateDropdown(dropdown: Element) {
175+ animate(dropdown, {
176+ opacity: { from: 0, to: 1 },
177+ filter: { from: 'blur(4px)', to: 'blur(0px)' },
178+ duration: 300,
179+ easing: 'cubicBezier(0.25, 0.1, 0.25, 1)',
180+ })
181+
182+ const items = dropdown.querySelectorAll('.dropdown-item')
183+ if (items.length) {
184+ animate(items, {
185+ opacity: { from: 0, to: 1 },
186+ translateY: { from: 20, to: 0 },
187+ filter: { from: 'blur(4px)', to: 'blur(0px)' },
188+ duration: 300,
189+ delay: stagger(150),
190+ easing: 'cubicBezier(0.25, 0.1, 0.25, 1)',
191+ })
192+ }
193+ }
194+
195+ // Initialize dropdown animations on page load and when toggles are shown
196+ document.addEventListener('DOMContentLoaded', () => {
197+ document.querySelectorAll('.dropdown-toggle').forEach(toggle => {
198+ const dropdown = toggle.querySelector('.navbar-dropdown')
199+ if (!dropdown) return
200+
201+ if (!toggle.classList.contains('hidden')) {
202+ animateDropdown(dropdown)
203+ }
204+
205+ const observer = new MutationObserver(mutations => {
206+ mutations.forEach(mutation => {
207+ if (mutation.attributeName === 'class' && !toggle.classList.contains('hidden')) {
208+ animateDropdown(dropdown)
209+ }
210+ })
211+ })
212+ observer.observe(toggle, { attributes: true })
213+ })
214+ })
215+ </script >
0 commit comments