From 9a64abff761abad05a7c954c07cdeac0b34a5314 Mon Sep 17 00:00:00 2001 From: Agent de manu Date: Mon, 8 Dec 2025 21:34:32 +0000 Subject: [PATCH] feat: navbar responsive avec menu hamburger mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Création composant MobileMenu.jsx avec React - Menu slide-in depuis la droite - Animation hamburger vers X - Overlay semi-transparent - Navigation desktop/mobile adaptative - Design minimal et élégant --- src/components/MobileMenu.jsx | 100 ++++++++++++++++++++++++++++++++++ src/components/Navbar.astro | 8 ++- 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/components/MobileMenu.jsx diff --git a/src/components/MobileMenu.jsx b/src/components/MobileMenu.jsx new file mode 100644 index 0000000..e2ba088 --- /dev/null +++ b/src/components/MobileMenu.jsx @@ -0,0 +1,100 @@ +import { useState } from 'react'; + +export default function MobileMenu({ currentPath }) { + const [isOpen, setIsOpen] = useState(false); + + const links = [ + { href: '/', label: 'Home' }, + { href: '/about', label: 'About' }, + { href: '/contact', label: 'Contact' }, + ]; + + return ( + <> + {/* Hamburger Button */} + + + {/* Mobile Menu Overlay */} + {isOpen && ( +
setIsOpen(false)} + /> + )} + + {/* Mobile Menu Panel */} +
+
+ {/* Header */} +
+ Menu + +
+ + {/* Navigation Links */} + + + {/* Footer */} +
+

Astro Starter Kit

+
+
+
+ + ); +} diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 689ddab..e120ebb 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -1,4 +1,6 @@ --- +import MobileMenu from "./MobileMenu.jsx"; + const currentPath = Astro.url.pathname; --- @@ -12,7 +14,8 @@ const currentPath = Astro.url.pathname; Starter Kit -
+ {/* Desktop Navigation */} + + + {/* Mobile Menu */} +