98 lines
3.5 KiB
TypeScript
98 lines
3.5 KiB
TypeScript
"use client";
|
||
|
||
import { useState } from "react";
|
||
import Link from "next/link";
|
||
import { usePathname } from "next/navigation";
|
||
import { Menu, X } from "lucide-react";
|
||
import { motion, AnimatePresence } from "framer-motion";
|
||
|
||
const NAV_ITEMS = [
|
||
{ href: "/", label: "Startseite" },
|
||
{ href: "/über-uns", label: "Über Uns" },
|
||
{ href: "/leistungen", label: "Leistungen" },
|
||
{ href: "/studio", label: "Studio" },
|
||
{ href: "/aktuelles", label: "Aktuelles" },
|
||
] as const;
|
||
|
||
export function Header() {
|
||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||
const pathname = usePathname();
|
||
|
||
return (
|
||
<header className="fixed top-0 left-0 right-0 z-50 bg-background/95 backdrop-blur-sm border-b border-border">
|
||
<div className="mx-auto flex items-center justify-between px-[var(--spacing-container-padding)] py-4" style={{ maxWidth: "var(--spacing-container)" }}>
|
||
<Link href="/" className="text-xl font-bold tracking-tight" aria-label="Sportbox Reutte – Zur Startseite">
|
||
SPORTBOX
|
||
</Link>
|
||
|
||
<nav className="hidden lg:flex items-center gap-8" aria-label="Hauptnavigation">
|
||
{NAV_ITEMS.map((item) => (
|
||
<Link
|
||
key={item.href}
|
||
href={item.href}
|
||
className={`text-sm tracking-wide transition-colors hover:text-muted ${
|
||
pathname === item.href ? "font-bold" : "font-normal"
|
||
}`}
|
||
>
|
||
{item.label}
|
||
</Link>
|
||
))}
|
||
<Link
|
||
href="/leistungen#kontakt"
|
||
className="bg-primary text-secondary px-5 py-2.5 text-sm font-medium transition-opacity hover:opacity-80"
|
||
>
|
||
Jetzt Termin buchen
|
||
</Link>
|
||
</nav>
|
||
|
||
<button
|
||
type="button"
|
||
className="lg:hidden p-2 -mr-2"
|
||
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
||
aria-expanded={mobileMenuOpen}
|
||
aria-controls="mobile-menu"
|
||
aria-label={mobileMenuOpen ? "Menü schließen" : "Menü öffnen"}
|
||
>
|
||
{mobileMenuOpen ? <X size={24} /> : <Menu size={24} />}
|
||
</button>
|
||
</div>
|
||
|
||
<AnimatePresence>
|
||
{mobileMenuOpen && (
|
||
<motion.nav
|
||
id="mobile-menu"
|
||
initial={{ height: 0, opacity: 0 }}
|
||
animate={{ height: "auto", opacity: 1 }}
|
||
exit={{ height: 0, opacity: 0 }}
|
||
transition={{ duration: 0.2 }}
|
||
className="lg:hidden overflow-hidden border-t border-border bg-background"
|
||
aria-label="Mobile Navigation"
|
||
>
|
||
<div className="flex flex-col px-[var(--spacing-container-padding)] py-4 gap-1">
|
||
{NAV_ITEMS.map((item) => (
|
||
<Link
|
||
key={item.href}
|
||
href={item.href}
|
||
onClick={() => setMobileMenuOpen(false)}
|
||
className={`py-3 text-base transition-colors hover:text-muted ${
|
||
pathname === item.href ? "font-bold" : "font-normal"
|
||
}`}
|
||
>
|
||
{item.label}
|
||
</Link>
|
||
))}
|
||
<Link
|
||
href="/leistungen#kontakt"
|
||
onClick={() => setMobileMenuOpen(false)}
|
||
className="mt-2 bg-primary text-secondary px-5 py-3 text-center text-sm font-medium transition-opacity hover:opacity-80"
|
||
>
|
||
Jetzt Termin buchen
|
||
</Link>
|
||
</div>
|
||
</motion.nav>
|
||
)}
|
||
</AnimatePresence>
|
||
</header>
|
||
);
|
||
}
|