Files
newsui/packages/docs/components/Header.tsx
T
sunzhongyi 729e6ab287 feat: migrate docs to Fumadocs framework
- Auto-generated sidebar from file structure
- Built-in search and TOC
- MDX native support with frontmatter
- Removed hand-written Sidebar component
- Docs now at /docs/* route (Landing/Blocks/Create/Examples unchanged)
- Content in content/docs/ as MDX files
2026-05-21 14:12:50 +08:00

91 lines
2.4 KiB
TypeScript

'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
const navItems = [
{ label: 'Docs', href: '/docs/grid-system' },
{ label: 'Components', href: '/docs/components/article' },
{ label: 'Themes', href: '/docs/theme' },
{ label: 'Blocks', href: '/blocks' },
{ label: 'Create', href: '/create' },
];
export function Header() {
const pathname = usePathname();
return (
<header
style={{
position: 'sticky',
top: 0,
zIndex: 50,
background: 'var(--nui-bg-page)',
borderBottom: '1px solid var(--nui-rule-hairline)',
backdropFilter: 'blur(8px)',
}}
>
<div
style={{
maxWidth: '1400px',
margin: '0 auto',
padding: '1rem 2rem',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
gap: '2rem',
}}
>
<Link
href="/"
style={{
fontFamily: 'var(--font-family-masthead)',
fontSize: '24px',
fontWeight: 700,
color: 'var(--nui-text-primary)',
textDecoration: 'none',
letterSpacing: '0.02em',
}}
>
NewspaperUI
</Link>
<nav style={{ display: 'flex', gap: '2rem' }}>
{navItems.map((item) => {
const active =
pathname === item.href ||
(item.href !== '/' && pathname.startsWith(item.href));
return (
<Link
key={item.href}
href={item.href}
style={{
fontFamily: 'var(--font-family-meta)',
fontSize: '14px',
fontWeight: 500,
color: active
? 'var(--nui-accent-primary)'
: 'var(--nui-text-secondary)',
textDecoration: 'none',
}}
>
{item.label}
</Link>
);
})}
<a
href="https://github.com/joisun/newspaperui"
target="_blank"
rel="noreferrer"
style={{
fontFamily: 'var(--font-family-meta)',
fontSize: '14px',
color: 'var(--nui-text-muted)',
textDecoration: 'none',
}}
>
GitHub
</a>
</nav>
</div>
</header>
);
}