Files
zhimingge/components/header.tsx
T
dekun 04c77dbf77 Support ultrawide layout with equal columns and taiji branding.
Use 50/50 mode workspace columns, widen content to 1920px on fish screens, replace header logo with taiji icon, and add full-page taiji backdrop.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 23:50:19 +08:00

56 lines
1.7 KiB
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { TaijiIcon } from "@/components/svg/taiji";
import { ModeToggle } from "@/components/mode-toggle";
import { APP_CONTAINER } from "@/lib/layout";
const NAV_ITEMS = [
{ href: "/learn", label: "易经学习" },
{ href: "/liuyao", label: "六爻算卦" },
{ href: "/bazi", label: "生辰八字" },
{ href: "/combined", label: "综合测算" },
];
function NavLink({ href, label }: { href: string; label: string }) {
const pathname = usePathname();
const active =
href === "/"
? pathname === "/"
: pathname === href || pathname.startsWith(`${href}/`);
return (
<Link
href={href}
className={`whitespace-nowrap text-sm transition-colors ${
active
? "font-medium text-foreground"
: "text-muted-foreground hover:text-foreground"
}`}
>
{label}
</Link>
);
}
export default function Header() {
return (
<header className="relative z-10 border-b border-border/40 bg-card/70 py-3 shadow-sm backdrop-blur-md">
<div className={`${APP_CONTAINER} flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`}>
<Link href="/" className="flex items-center justify-center gap-2 sm:justify-start">
<TaijiIcon />
<span className="font-medium tracking-wide"></span>
</Link>
<nav className="flex flex-wrap items-center justify-center gap-x-4 gap-y-1">
{NAV_ITEMS.map((item) => (
<NavLink key={item.href} {...item} />
))}
</nav>
<div className="flex justify-center sm:justify-end">
<ModeToggle />
</div>
</div>
</header>
);
}