From 940eae61767214eb1ee573284dc8b5876d536fb3 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sun, 12 Jan 2025 19:44:19 +0900
Subject: refactor(blog/nuldoc): convert pages/*.ts to TSX

---
 vhosts/blog/nuldoc-src/pages/slide_list.tsx | 54 +++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 vhosts/blog/nuldoc-src/pages/slide_list.tsx

(limited to 'vhosts/blog/nuldoc-src/pages/slide_list.tsx')

diff --git a/vhosts/blog/nuldoc-src/pages/slide_list.tsx b/vhosts/blog/nuldoc-src/pages/slide_list.tsx
new file mode 100644
index 00000000..31eeca68
--- /dev/null
+++ b/vhosts/blog/nuldoc-src/pages/slide_list.tsx
@@ -0,0 +1,54 @@
+import GlobalFooter from "../components/GlobalFooter.tsx";
+import { renderToDOM } from "../jsx/render.ts";
+import GlobalHeader from "../components/GlobalHeader.tsx";
+import PageLayout from "../components/PageLayout.tsx";
+import SlidePageEntry from "../components/SlidePageEntry.tsx";
+import { Config } from "../config.ts";
+import { el } from "../dom.ts";
+import { Page } from "../page.ts";
+import { dateToString } from "../revision.ts";
+import { getPostPublishedDate } from "./post.tsx";
+import { SlidePage } from "./slide.tsx";
+
+export type SlideListPage = Page;
+
+export async function generateSlideListPage(
+  slides: SlidePage[],
+  config: Config,
+): Promise<SlideListPage> {
+  const pageTitle = "スライド一覧";
+
+  const html = await renderToDOM(
+    <PageLayout
+      metaCopyrightYear={config.blog.siteCopyrightYear}
+      metaDescription="登壇したイベントで使用したスライドの一覧"
+      metaTitle={`${pageTitle}｜${config.blog.siteName}`}
+      metaAtomFeedHref={`https://${config.blog.fqdn}/slides/atom.xml`}
+      config={config}
+    >
+      <body className="list">
+        <GlobalHeader config={config} />
+        <main className="main">
+          <header className="page-header">
+            <h1>{pageTitle}</h1>
+          </header>
+          {Array.from(slides).sort((a, b) => {
+            const ta = dateToString(getPostPublishedDate(a));
+            const tb = dateToString(getPostPublishedDate(b));
+            if (ta > tb) return -1;
+            if (ta < tb) return 1;
+            return 0;
+          }).map((slide) => <SlidePageEntry slide={slide} />)}
+        </main>
+        <GlobalFooter config={config} />
+      </body>
+    </PageLayout>,
+  );
+
+  return {
+    root: el("__root__", {}, html),
+    renderer: "html",
+    destFilePath: "/slides/index.html",
+    href: "/slides/",
+  };
+}
-- 
cgit v1.2.3-70-g09d2

