"use client"; import { AnimatePresence, motion } from "framer-motion"; import Image from "next/image"; import Link from "next/link"; import { useSafePathname } from "./analytics/useSafePathname"; import * as React from "react"; import IconWhite from "../assets/logo/Icon-White-Transparent.svg"; export const Header: React.FC = () => { const pathname = useSafePathname(); const [isScrolled, setIsScrolled] = React.useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false); React.useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 20); }; window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); // Close mobile menu on pathname change and handle body scroll lock React.useEffect(() => { setIsMobileMenuOpen(false); }, [pathname]); React.useEffect(() => { if (isMobileMenuOpen) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = "unset"; } return () => { document.body.style.overflow = "unset"; }; }, [isMobileMenuOpen]); const isActive = (path: string) => pathname === path; const navLinks = [ { href: "/about", label: "Über mich" }, { href: "/websites", label: "Websites" }, { href: "/case-studies", label: "Case Studies", prefix: true }, { href: "/blog", label: "Blog", prefix: true }, ]; return (
{/* Decoupled Background Layer - Prevents backdrop-filter parent context bugs */}
{/* Animated tech border at bottom */}
Marc Mintel Icon
{/* Desktop Navigation */} {/* Mobile Toggle */}
{/* Mobile Navigation - Bottom-Anchored Control Center */} {isMobileMenuOpen && ( {/* Dimmed Backdrop */} setIsMobileMenuOpen(false)} className="fixed inset-0 z-[101] bg-black/30 backdrop-blur-sm md:hidden" /> {/* Bottom Sheet */} { if (info.offset.y > 80 || info.velocity.y > 300) { setIsMobileMenuOpen(false); } }} className="fixed inset-x-0 bottom-0 z-[102] md:hidden bg-white rounded-t-[2rem] shadow-[0_-8px_40px_rgba(0,0,0,0.12)] flex flex-col max-h-[85vh] overflow-hidden" > {/* Grab Handle */}
{/* Status Bar */}
Online
{pathname === "/" ? "HOME" : pathname.toUpperCase().replace(/^\//, "")}
{/* Tiled Navigation Grid */}
{[ { href: "/about", label: "Über mich", sub: "Architect" }, { href: "/websites", label: "Websites", sub: "Systems" }, { href: "/case-studies", label: "Cases", sub: "Solutions", prefix: true, }, { href: "/blog", label: "Blog", sub: "Insights", prefix: true, }, ].map((item, i) => { const active = item.prefix ? pathname?.startsWith(item.href) : pathname === item.href; return ( setIsMobileMenuOpen(false)} className={`relative flex flex-col justify-center p-6 h-[110px] rounded-2xl border transition-all duration-200 ${active ? "bg-slate-50 border-slate-200 ring-1 ring-slate-200" : "bg-white border-slate-100 active:bg-slate-50" }`} >
{item.label} {item.sub}
{active && (
)} ); })}
{/* Primary CTA */}
setIsMobileMenuOpen(false)} className="flex items-center justify-between w-full p-4 bg-slate-900 text-white rounded-2xl active:bg-slate-800 transition-colors" > Projekt anfragen
{/* Safe-Area Spacer (iOS home indicator) */}
)}
); };