35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import Head from 'next/head';
|
|
import Link from 'next/link';
|
|
import { useRouter } from 'next/router';
|
|
import { ReactNode } from 'react';
|
|
|
|
const LINKS = [
|
|
{ href: '/', label: 'Home' },
|
|
{ href: '/overview', label: 'Overview' },
|
|
{ href: '/papers', label: 'Papers' },
|
|
{ href: '/landscape', label: 'Landscape' },
|
|
{ href: '/contents', label: 'Contents' },
|
|
];
|
|
|
|
export default function Layout({ title, children }: { title?: string; children: ReactNode }) {
|
|
const { pathname } = useRouter();
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>{title ? `${title} · AI-tlas` : 'AI-tlas · AI Taxonomy, Literature Analysis & Survey'}</title>
|
|
<meta name="description" content="Explore AI papers through topic taxonomies, literature analysis and structured surveys." />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
</Head>
|
|
<nav className="nav">
|
|
<Link href="/" className="brand">AI-tlas</Link>
|
|
{LINKS.map((l) => (
|
|
<Link key={l.href} href={l.href} className={(l.href === '/' ? pathname === '/' : pathname.startsWith(l.href)) ? 'active' : ''}>
|
|
{l.label}
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
<main className="wrap">{children}</main>
|
|
</>
|
|
);
|
|
}
|