63 lines
2.5 KiB
TypeScript
63 lines
2.5 KiB
TypeScript
import type { ReactNode } from "react";
|
|
|
|
import Link from "next/link";
|
|
|
|
import { BrandLogo } from "@/components/brand/logo";
|
|
import { LogoutButton } from "@/components/layout/logout-button";
|
|
import { MobilePortalMenu } from "@/components/layout/mobile-portal-menu";
|
|
import { ThemeToggle } from "@/components/theme-toggle";
|
|
|
|
export type NavItem = { href: string; label: string };
|
|
|
|
type PortalShellProps = {
|
|
brandHref: string;
|
|
sectionLabel: string;
|
|
nav: NavItem[];
|
|
// Editorial pages are wrapped in `.editorial-work-surface` (width + padding),
|
|
// so their content uses `.editorial-section` (max-width: 100%). Admin pages
|
|
// bring their own `.content-section` container (width + padding), so the
|
|
// shell must not add a second width wrapper — pass an empty string here.
|
|
mainClassName?: string;
|
|
children: ReactNode;
|
|
};
|
|
|
|
export function PortalShell({
|
|
brandHref,
|
|
sectionLabel,
|
|
nav,
|
|
mainClassName = "editorial-work-surface",
|
|
children,
|
|
}: Readonly<PortalShellProps>) {
|
|
return (
|
|
<div className="min-h-screen bg-background flex flex-col">
|
|
<header className="sticky top-0 z-50 w-full border-b border-border/40 bg-background/80 backdrop-blur-md transition-colors duration-300">
|
|
<div className="flex h-16 items-center justify-between px-4 sm:px-6 lg:px-12">
|
|
<Link aria-label={sectionLabel} className="flex items-center gap-2 transition-opacity hover:opacity-80" href={brandHref}>
|
|
<div className="flex items-center"><BrandLogo /></div>
|
|
</Link>
|
|
<div className="flex items-center gap-6 text-sm font-medium">
|
|
<span className="hidden lg:inline-block text-muted-foreground uppercase tracking-widest text-xs font-bold">{sectionLabel}</span>
|
|
<nav aria-label={sectionLabel} className="hidden sm:flex items-center gap-4 lg:gap-6">
|
|
{nav.map((item) => (
|
|
<Link
|
|
key={item.href}
|
|
href={item.href}
|
|
className="transition-colors hover:text-primary-500 text-foreground"
|
|
>
|
|
{item.label}
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
<div className="hidden items-center gap-4 sm:flex">
|
|
<ThemeToggle />
|
|
<LogoutButton />
|
|
</div>
|
|
<MobilePortalMenu nav={nav} sectionLabel={sectionLabel} />
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<main className="flex-1 w-full max-w-7xl mx-auto px-6 py-12 lg:px-12 lg:py-16">{children}</main>
|
|
</div>
|
|
);
|
|
}
|