"use client"; /** * SiteHeader — the single global navigation header. * * Sits at the top of every page (mounted in app/layout.tsx) so the page-specific * PageHeader can stay focused on titles and breadcrumbs. * * Layout: * * ┌─────────────────────────────────────────────────────────────┐ * │ PRABHUPĀDA Books · Letters · Lectures · Glossary ⌕ ⚙ ◐ │ * │ SAYS │ * └─────────────────────────────────────────────────────────────┘ * * - Serif uppercase wordmark on the left (links home) * - Section nav inline on md+; collapsed into the mobile drawer below * - Right cluster: HeaderSearchButton, ReadingSettings, UserMenu * - Sticky with a subtle border + backdrop blur when scrolled * * The HeaderSearchButton's expand-into-full-width behavior is preserved by * giving it the same conditional flex treatment that PageHeader used to do — * when expanded on mobile the wordmark + nav collapse out of the way. */ import { useState } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { HeaderSearchButton } from "@/components/header-search"; import { ReadingSettings } from "@/components/reading-settings"; import { UserMenu } from "@/components/auth/user-menu"; import { MobileNavToggle } from "@/components/site-mobile-nav"; import { cn } from "@/lib/utils"; const PRIMARY_NAV = [ { href: "/books", label: "Books" }, { href: "/letters", label: "Letters" }, { href: "/transcriptions", label: "Lectures" }, { href: "/essays", label: "Essays" }, { href: "/glossary", label: "Glossary" }, ] as const; export function SiteHeader() { const [searchExpanded, setSearchExpanded] = useState(false); const pathname = usePathname(); function isActive(href: string): boolean { if (href === "/") return pathname === "/"; return pathname.startsWith(href); } return (
{/* Mobile hamburger — visible below md, hidden when search is expanded */}
{/* Brand wordmark — two-line stacked "Prabhupāda / SAYS". Smaller type sizes on mobile so the row fits next to the hamburger and action icons on narrow phones (≤375px). */} Prabhupāda Says {/* Primary nav — desktop only; mobile uses the drawer. Stays visible even when search is expanded — on desktop the search input has a fixed max-width and fits alongside the nav, so there's no need to remove items (which would cause layout shift). */} {/* Spacer pushes the action cluster to the right on mobile */}
{/* Action cluster — search, reading-settings, user menu. On mobile when search is expanded, the cluster fills the row so the input can grow. On desktop it always stays shrink-0 — the expanded search input has its own fixed max-width and doesn't need to steal space from the nav. */}
); }