Skip to content

Commit af2b200

Browse files
committed
feat: Enhance mobile menu with donation options and download button
1 parent 976e5e3 commit af2b200

File tree

1 file changed

+99
-8
lines changed

1 file changed

+99
-8
lines changed

website/src/components/Header.astro

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ const navItems = [
1111
<header class="fixed top-0 left-0 right-0 z-50 bg-black/50 backdrop-blur-xl border-b border-white/10">
1212
<nav class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
1313
<div class="flex items-center justify-between h-16">
14-
<!-- Logo -->
14+
<!-- Logo (always visible) -->
1515
<a href="/MyMacCleaner/" class="flex items-center gap-3 group">
1616
<img
1717
src="/MyMacCleaner/icon-192.png"
1818
alt="MyMacCleaner"
1919
class="w-9 h-9 rounded-xl shadow-lg group-hover:shadow-xl transition-shadow"
2020
/>
21-
<span class="font-semibold text-white text-lg hidden sm:block">MyMacCleaner</span>
21+
<span class="font-semibold text-white text-lg">MyMacCleaner</span>
2222
</a>
2323

24-
<!-- Navigation -->
25-
<div class="flex items-center gap-1">
24+
<!-- Desktop Navigation (hidden on mobile) -->
25+
<div class="hidden md:flex items-center gap-1">
2626
{navItems.map((item) => (
2727
<a
2828
href={item.href}
@@ -44,7 +44,7 @@ const navItems = [
4444
title="Support the project"
4545
>
4646
<Icon name="lucide:heart" class="w-4 h-4" />
47-
<span class="hidden sm:inline">Donate</span>
47+
<span>Donate</span>
4848
<Icon name="lucide:chevron-down" class="w-3 h-3 ml-0.5" />
4949
</button>
5050
<div class="donate-menu absolute right-0 mt-2 w-48 rounded-xl bg-black/90 backdrop-blur-xl border border-white/10 shadow-xl opacity-0 invisible transition-all duration-200 z-50">
@@ -82,10 +82,101 @@ const navItems = [
8282
</a>
8383
</div>
8484

85-
<!-- Mobile Menu Button (hidden for now, can expand later) -->
86-
<button class="md:hidden p-2 text-gray-300 hover:text-white" aria-label="Menu">
87-
<Icon name="lucide:menu" class="w-6 h-6" />
85+
<!-- Mobile Menu Button (visible on mobile only) -->
86+
<button
87+
id="mobile-menu-button"
88+
class="md:hidden p-2 text-gray-300 hover:text-white hover:bg-white/10 rounded-lg transition-colors"
89+
aria-label="Toggle menu"
90+
aria-expanded="false"
91+
>
92+
<Icon name="lucide:menu" class="w-6 h-6 menu-icon" />
93+
<Icon name="lucide:x" class="w-6 h-6 close-icon hidden" />
8894
</button>
8995
</div>
9096
</nav>
97+
98+
<!-- Mobile Menu (hidden by default) -->
99+
<div id="mobile-menu" class="md:hidden hidden border-t border-white/10 bg-black/80 backdrop-blur-xl">
100+
<div class="px-4 py-4 space-y-2">
101+
{navItems.map((item) => (
102+
<a
103+
href={item.href}
104+
target={item.external ? '_blank' : undefined}
105+
rel={item.external ? 'noopener noreferrer' : undefined}
106+
class="flex items-center gap-2 px-4 py-3 text-gray-300 hover:text-white hover:bg-white/10 rounded-lg transition-colors"
107+
>
108+
{item.label}
109+
{item.external && (
110+
<Icon name="lucide:external-link" class="w-4 h-4 opacity-50" />
111+
)}
112+
</a>
113+
))}
114+
115+
<!-- Mobile Donate Options -->
116+
<div class="border-t border-white/10 pt-2 mt-2">
117+
<p class="px-4 py-2 text-xs text-gray-500 uppercase tracking-wider">Support</p>
118+
<a
119+
href="https://paypal.me/andreaprotani99"
120+
target="_blank"
121+
rel="noopener noreferrer"
122+
class="flex items-center gap-3 px-4 py-3 text-gray-300 hover:text-white hover:bg-white/10 rounded-lg transition-colors"
123+
>
124+
<Icon name="simple-icons:paypal" class="w-5 h-5 text-[#003087]" />
125+
PayPal
126+
</a>
127+
<a
128+
href="https://buymeacoffee.com/prot10"
129+
target="_blank"
130+
rel="noopener noreferrer"
131+
class="flex items-center gap-3 px-4 py-3 text-gray-300 hover:text-white hover:bg-white/10 rounded-lg transition-colors"
132+
>
133+
<Icon name="simple-icons:buymeacoffee" class="w-5 h-5 text-[#FFDD00]" />
134+
Buy Me a Coffee
135+
</a>
136+
</div>
137+
138+
<!-- Mobile Download Button -->
139+
<div class="pt-2">
140+
<a
141+
href="https://github.com/Prot10/MyMacCleaner/releases/latest"
142+
target="_blank"
143+
rel="noopener noreferrer"
144+
class="block w-full px-4 py-3 text-center font-medium text-white bg-primary hover:bg-primary-600 rounded-lg transition-colors shadow-lg shadow-primary/25"
145+
>
146+
Download
147+
</a>
148+
</div>
149+
</div>
150+
</div>
91151
</header>
152+
153+
<script>
154+
const mobileMenuButton = document.getElementById('mobile-menu-button');
155+
const mobileMenu = document.getElementById('mobile-menu');
156+
const menuIcon = mobileMenuButton?.querySelector('.menu-icon');
157+
const closeIcon = mobileMenuButton?.querySelector('.close-icon');
158+
159+
mobileMenuButton?.addEventListener('click', () => {
160+
const isExpanded = mobileMenuButton.getAttribute('aria-expanded') === 'true';
161+
162+
// Toggle menu visibility
163+
mobileMenu?.classList.toggle('hidden');
164+
165+
// Toggle icons
166+
menuIcon?.classList.toggle('hidden');
167+
closeIcon?.classList.toggle('hidden');
168+
169+
// Update aria-expanded
170+
mobileMenuButton.setAttribute('aria-expanded', (!isExpanded).toString());
171+
});
172+
173+
// Close menu when clicking a link
174+
mobileMenu?.querySelectorAll('a').forEach(link => {
175+
link.addEventListener('click', () => {
176+
mobileMenu.classList.add('hidden');
177+
menuIcon?.classList.remove('hidden');
178+
closeIcon?.classList.add('hidden');
179+
mobileMenuButton?.setAttribute('aria-expanded', 'false');
180+
});
181+
});
182+
</script>

0 commit comments

Comments
 (0)