d4af89c7f7
Deploy / deploy (push) Successful in 6m36s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
32 lines
1.1 KiB
TypeScript
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>
|
|
);
|
|
}
|