From 7567932c7070288186f4f1a78056935fe428d8e8 Mon Sep 17 00:00:00 2001 From: Matheo Guilbert Date: Thu, 16 Apr 2026 09:24:28 +0200 Subject: [PATCH] header hamburger menu for mobile format --- components/layout/Header.tsx | 100 ++++++++++++++++++++++++++-- components/sections/HeroSection.tsx | 4 +- 2 files changed, 96 insertions(+), 8 deletions(-) diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx index dc5576c..7926fa1 100644 --- a/components/layout/Header.tsx +++ b/components/layout/Header.tsx @@ -1,16 +1,21 @@ 'use client'; -import React, { MouseEvent } from 'react'; +import React, { useState, useEffect, MouseEvent } from 'react'; +import { CiMenuFries } from "react-icons/ci"; +import { IoCloseOutline } from "react-icons/io5"; export default function Header() { const links = [ - {"text": "Accueil" , "target": "/"}, - {"text": "Travaux" , "target": "/#works"}, - {"text": "À propos" , "target": "/#about"}, - {"text": "Blog" , "target": "/blog"}, + { "text": "Accueil", "target": "/" }, + { "text": "Travaux", "target": "/#works" }, + { "text": "À propos", "target": "/#about" }, + { "text": "Blog", "target": "/blog" }, ]; + const [isOpen, setIsOpen] = useState(false); + const [showText, setShowText] = useState(false); + const handleAnchorClick = (e: MouseEvent, target: string) => { if (target.startsWith("/#")) { // only anchor links e.preventDefault(); @@ -20,22 +25,105 @@ export default function Header() { element.scrollIntoView({ behavior: "smooth" }); } } + setIsOpen(false); }; + useEffect(() => { + if (isOpen) { + const timer = setTimeout(() => setShowText(true), 450); + return () => clearTimeout(timer); + } else { + setShowText(false); + } + }, [isOpen]); + return (
M. Guilbert
logo mg dev + + {/* Desktop */}
France
+ + {/* Mobile */} +
+ + {/* Overlay mobile menu */} +
+ {/* wave / circle that fills the screen */} +
+ + {/* content */} +
+ + {/* top bar */} +
+
+ M. Guilbert +
+ + +
+ + {/* liens */} + + + {/* footer */} +
+ France +
+
+
); diff --git a/components/sections/HeroSection.tsx b/components/sections/HeroSection.tsx index 9da9f38..e645fbb 100644 --- a/components/sections/HeroSection.tsx +++ b/components/sections/HeroSection.tsx @@ -5,7 +5,7 @@ export default function HeroSection() {
{/* Title + image container */}
{/* Rotating texts */}
@@ -14,7 +14,7 @@ export default function HeroSection() {
{/* Image */} - Image of me + Image of me
{/* Call to scroll */}