From 4ab07d93e9fd657dd1227ecfd6519bc365e5bf9a Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 15 Apr 2026 17:15:56 +0200 Subject: [PATCH] Update navbar --- src/app/page.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 075cd60..b891fc6 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -66,6 +66,8 @@ export default function Home() { const [lang, setLang] = useState('fr'); const [isLangOpen, setIsLangOpen] = useState(false); const langDropdownRef = useRef(null); + const [navVisible, setNavVisible] = useState(true); + const lastScrollY = useRef(0); const t = translations[lang]; @@ -76,6 +78,17 @@ export default function Home() { value: t.modules.items[i].value, })); + // Hide navbar on scroll down, show on scroll up + useEffect(() => { + const handleScroll = () => { + const currentY = window.scrollY; + setNavVisible(currentY < lastScrollY.current || currentY < 10); + lastScrollY.current = currentY; + }; + window.addEventListener('scroll', handleScroll, { passive: true }); + return () => window.removeEventListener('scroll', handleScroll); + }, []); + // Lock body scroll when mobile menu is open useEffect(() => { if (isMenuOpen) { @@ -140,7 +153,7 @@ export default function Home() { return (
{/* Top Navigation */} -
+