Files
ai-taxonomy-literature-anal…/pages/contents/index.tsx
T
2026-10-23 05:23:13 +00:00

32 lines
1.1 KiB
TypeScript

import Link from 'next/link';
import Layout from '../../components/Layout';
import { CONTENT_TREE, ContentNode } from '../../lib/content-tree';
function Toc({ nodes, prefix }: { nodes: ContentNode[]; prefix: string }) {
return (
<ol style={{ listStyle: 'none', paddingLeft: prefix ? 24 : 0 }}>
{nodes.map((n, i) => {
const num = `${prefix}${i + 1}`;
return (
<li key={n.id} style={{ margin: '10px 0' }}>
<span className="sub" style={{ margin: 0, marginRight: 8 }}>{num}</span>
<Link href={`/contents/${n.id}`}><b>{n.title}</b></Link>
<div className="sub" style={{ margin: '2px 0 0 28px', fontSize: 13 }}>{n.blurb}</div>
{n.children.length > 0 && <Toc nodes={n.children} prefix={`${num}.`} />}
</li>
);
})}
</ol>
);
}
export default function Contents() {
return (
<Layout title="Contents">
<h1>Contents</h1>
<p className="sub">{CONTENT_TREE.blurb} Each entry opens its own page.</p>
<div className="card"><Toc nodes={CONTENT_TREE.children} prefix="" /></div>
</Layout>
);
}