fix: navbar mobile hamburger expand
All checks were successful
Build and Push Madplaner / build (push) Successful in 24s
All checks were successful
Build and Push Madplaner / build (push) Successful in 24s
This commit is contained in:
@@ -55,19 +55,31 @@
|
||||
{% if current_user.is_authenticated %}
|
||||
<a href="/dashboard" class="text-sm font-medium text-stone-600 hover:text-emerald-800 transition-colors">Dashboard</a>
|
||||
<div class="h-4 w-px bg-stone-200"></div>
|
||||
<div class="flex items-center gap-4">
|
||||
<a href="/logout" class="text-sm font-medium bg-stone-100 text-stone-900 px-4 py-2 rounded-full hover:bg-stone-200 transition-all">Sign Out</a>
|
||||
</div>
|
||||
<a href="/logout" class="text-sm font-medium bg-stone-100 text-stone-900 px-4 py-2 rounded-full hover:bg-stone-200 transition-all">Sign Out</a>
|
||||
{% else %}
|
||||
<a href="/login" class="text-sm font-medium text-stone-600 hover:text-stone-900">Login</a>
|
||||
<a href="/register" class="text-sm font-medium bg-emerald-800 text-white px-6 py-2.5 rounded-full hover:bg-emerald-900 shadow-sm transition-all">Register</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="md:hidden text-stone-900">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<button id="menu-toggle" class="md:hidden text-stone-900 p-2 focus:outline-none">
|
||||
<svg id="menu-icon" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 6h16M4 12h16m-7 6h7" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="mobile-menu" class="hidden md:hidden bg-white/95 backdrop-blur-xl border-b border-stone-100 px-6 py-8 space-y-6 shadow-xl">
|
||||
<div class="flex flex-col gap-6">
|
||||
<a href="/about" class="text-lg font-medium text-stone-600">About</a>
|
||||
{% if current_user.is_authenticated %}
|
||||
<a href="/dashboard" class="text-lg font-medium text-stone-600">Dashboard</a>
|
||||
<hr class="border-stone-100">
|
||||
<a href="/logout" class="text-lg font-medium text-stone-900">Sign Out</a>
|
||||
{% else %}
|
||||
<a href="/login" class="text-lg font-medium text-stone-600">Login</a>
|
||||
<a href="/register" class="text-center bg-emerald-800 text-white py-4 rounded-2xl font-semibold">Register</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -76,5 +88,29 @@
|
||||
</main>
|
||||
</body>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const menuToggle = document.getElementById('menu-toggle');
|
||||
const mobileMenu = document.getElementById('mobile-menu');
|
||||
|
||||
menuToggle.addEventListener('click', () => {
|
||||
// Toggle the 'hidden' class to show/hide the menu
|
||||
const isHidden = mobileMenu.classList.toggle('hidden');
|
||||
|
||||
// Optional: Prevent background scrolling when menu is open
|
||||
if (!isHidden) {
|
||||
document.body.style.overflow = 'hidden';
|
||||
} else {
|
||||
document.body.style.overflow = '';
|
||||
}
|
||||
});
|
||||
|
||||
const mobileLinks = mobileMenu.querySelectorAll('a');
|
||||
mobileLinks.forEach(link => {
|
||||
link.addEventListener('click', () => {
|
||||
mobileMenu.classList.add('hidden');
|
||||
document.body.style.overflow = '';
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user