@@ -32,7 +32,7 @@ const {
32
32
class =" hidden items-center gap-6 place-self-center text-xs sm:text-sm lg:flex lg:text-base"
33
33
>
34
34
<Dropdown class =" group" >
35
- <button class =" flex items-center" >
35
+ <button class =" flex items-center rounded-lg p-3 hover:bg-muted group-open:bg-muted " >
36
36
<span >{ menu .gettingStarted } </span >
37
37
<ChevronDownIcon
38
38
class =" size-4 transform transition-transform duration-200 group-open:rotate-180 md:ml-2"
@@ -66,7 +66,7 @@ const {
66
66
</DropdownItems >
67
67
</Dropdown >
68
68
<Dropdown class =" group" >
69
- <button class =" flex items-center" >
69
+ <button class =" flex items-center rounded-lg p-3 hover:bg-muted group-open:bg-muted " >
70
70
<span >{ menu .usefulLinks } </span >
71
71
<ChevronDownIcon
72
72
class =" size-4 transform transition-transform duration-200 group-open:rotate-180 md:ml-2"
@@ -80,12 +80,6 @@ const {
80
80
{ menu .donateDesc }
81
81
</div >
82
82
</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 >
89
83
<a class =" dropdown-item" href =" https://docs.zen-browser.app" >
90
84
<div class =" dropdown-title" >{ menu .documentation } </div >
91
85
<div class =" dropdown-description" >
@@ -101,7 +95,16 @@ const {
101
95
</div >
102
96
</DropdownItems >
103
97
</Dropdown >
104
- <a class =" hidden items-center lg:block" href ={ getLocalePath (' /mods' )} >
98
+ <a
99
+ class ={ ` hidden items-center hover:bg-muted rounded-lg p-3 lg:block${Astro .url .pathname === getLocalePath (' /about' ) ? ' text-coral' : ' ' } ` }
100
+ href ={ getLocalePath (' /about' )}
101
+ >
102
+ <span >{ menu .aboutUs } </span >
103
+ </a >
104
+ <a
105
+ class ={ ` hidden items-center hover:bg-muted rounded-lg p-3 lg:block${Astro .url .pathname === getLocalePath (' /mods' ) ? ' text-coral' : ' ' } ` }
106
+ href ={ getLocalePath (' /mods' )}
107
+ >
105
108
<span >{ menu .mods } </span >
106
109
</a >
107
110
</div >
@@ -135,7 +138,7 @@ const {
135
138
136
139
<style >
137
140
.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 ;
141
+ @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 ;
139
142
& .dropdown-item {
140
143
@apply flex cursor-pointer select-none flex-col gap-2 rounded-lg p-4 transition-colors duration-200;
141
144
@@ -158,3 +161,48 @@ const {
158
161
@apply text-dark;
159
162
}
160
163
</style >
164
+ <script >
165
+ import { animate, stagger } from 'animejs'
166
+
167
+ function animateDropdown(dropdown: Element) {
168
+ animate(dropdown, {
169
+ opacity: { from: 0, to: 1 },
170
+ filter: { from: 'blur(4px)', to: 'blur(0px)' },
171
+ duration: 300,
172
+ easing: 'cubicBezier(0.25, 0.1, 0.25, 1)',
173
+ })
174
+
175
+ const items = dropdown.querySelectorAll('.dropdown-item')
176
+ if (items.length) {
177
+ animate(items, {
178
+ opacity: { from: 0, to: 1 },
179
+ translateY: { from: 20, to: 0 },
180
+ filter: { from: 'blur(4px)', to: 'blur(0px)' },
181
+ duration: 300,
182
+ delay: stagger(150),
183
+ easing: 'cubicBezier(0.25, 0.1, 0.25, 1)',
184
+ })
185
+ }
186
+ }
187
+
188
+ // Initialize dropdown animations on page load
189
+ document.addEventListener('DOMContentLoaded', () => {
190
+ document.querySelectorAll('.dropdown-toggle').forEach(toggle => {
191
+ const dropdown = toggle.querySelector('.navbar-dropdown')
192
+ if (!dropdown) return
193
+
194
+ if (!toggle.classList.contains('hidden')) {
195
+ animateDropdown(dropdown)
196
+ }
197
+
198
+ const observer = new MutationObserver(mutations => {
199
+ mutations.forEach(mutation => {
200
+ if (mutation.attributeName === 'class' && !toggle.classList.contains('hidden')) {
201
+ animateDropdown(dropdown)
202
+ }
203
+ })
204
+ })
205
+ observer.observe(toggle, { attributes: true })
206
+ })
207
+ })
208
+ </script >
0 commit comments