From 52bfd3791b7b30761208e97e930a7597034dce72 Mon Sep 17 00:00:00 2001 From: Maaxxs <61059039+MaaxxsDev@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:52:40 +0200 Subject: [PATCH] Remove header contact bar, merge header with hero on the homepage Drops the phone/WhatsApp/shop row that sat above the main navbar row (still reachable via the fullscreen menu). On the homepage, the header now starts fully transparent - merged with the hero image, icons in white - and only becomes the opaque bar once the user scrolls past a small threshold. Other pages keep the normal opaque header throughout, since they don't have a hero to merge with. Co-Authored-By: Claude Sonnet 5 --- hifi-src/src/components/Navbar.jsx | 68 ++++++++++++------------- hifi-src/src/components/ThemeToggle.jsx | 6 ++- hifi-src/src/pages/public/Home.jsx | 2 +- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/hifi-src/src/components/Navbar.jsx b/hifi-src/src/components/Navbar.jsx index da689ba..b1d6015 100644 --- a/hifi-src/src/components/Navbar.jsx +++ b/hifi-src/src/components/Navbar.jsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import { createPortal } from 'react-dom'; -import { Link } from 'react-router-dom'; +import { Link, useLocation } from 'react-router-dom'; import ThemeToggle from './ThemeToggle.jsx'; import DynamicIcon from './DynamicIcon.jsx'; import { useAuth } from '../context/AuthContext.jsx'; @@ -21,6 +21,24 @@ export default function Navbar() { const { user } = useAuth(); const { phone, whatsapp } = useSiteSettings(); const totalItems = whatsapp ? 8 : 7; + const location = useLocation(); + const isHome = location.pathname === '/'; + const [scrolled, setScrolled] = useState(!isHome); + + // Auf der Startseite beginnt der Header transparent, verschmolzen mit dem Hero-Bild, + // und wird erst zur weissen/dunklen Leiste, sobald man zu scrollen beginnt. + useEffect(() => { + if (!isHome) { + setScrolled(true); + return; + } + const handleScroll = () => setScrolled(window.scrollY > 24); + handleScroll(); + window.addEventListener('scroll', handleScroll, { passive: true }); + return () => window.removeEventListener('scroll', handleScroll); + }, [isHome]); + + const transparent = isHome && !scrolled; useEffect(() => { if (open) { @@ -58,48 +76,30 @@ export default function Navbar() { to="/admin" aria-label="Zum Admin-Panel" title="Zum Admin-Panel" - className="rounded-full p-2 text-neutral-600 transition hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800" + className={`rounded-full p-2 transition ${ + transparent ? 'text-white hover:bg-white/10' : 'text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800' + }`} > ); return ( -
- {/* Schmale Kontakt-Leiste (Telefon/WhatsApp/Shop) - auf kleinen Screens ausgeblendet, - steht dort stattdessen im aufklappbaren mobilen Menü. */} -
-
- {phone && ( - - - {phone} - - )} - {whatsapp && ( - - - WhatsApp - - )} - - - Zum Shop - -
-
- +
- + HifiPlanet
{AdminIcon} - +
diff --git a/hifi-src/src/components/ThemeToggle.jsx b/hifi-src/src/components/ThemeToggle.jsx index 8041df8..722b114 100644 --- a/hifi-src/src/components/ThemeToggle.jsx +++ b/hifi-src/src/components/ThemeToggle.jsx @@ -1,13 +1,15 @@ import { useTheme } from '../context/ThemeContext.jsx'; -export default function ThemeToggle() { +export default function ThemeToggle({ overHero = false }) { const { theme, toggleTheme } = useTheme(); return (