summaryrefslogtreecommitdiffhomepage
path: root/services/blog/nuldoc-src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-07-02 00:15:42 +0900
committernsfisis <nsfisis@gmail.com>2025-07-02 00:22:26 +0900
commit36e0a3f8486bb2a8b288694dcf460a75d0517f57 (patch)
tree1f149e830c42fc005001f411bbc936be204b58c5 /services/blog/nuldoc-src
parenta7cd871b183679a8fe5287155283d23bff9d5d56 (diff)
downloadnsfisis.dev-36e0a3f8486bb2a8b288694dcf460a75d0517f57.tar.gz
nsfisis.dev-36e0a3f8486bb2a8b288694dcf460a75d0517f57.tar.zst
nsfisis.dev-36e0a3f8486bb2a8b288694dcf460a75d0517f57.zip
feat(blog/nuldoc): show entry tags in list page
Diffstat (limited to 'services/blog/nuldoc-src')
-rw-r--r--services/blog/nuldoc-src/components/PostPageEntry.tsx9
-rw-r--r--services/blog/nuldoc-src/components/SlidePageEntry.tsx9
-rw-r--r--services/blog/nuldoc-src/components/TagList.tsx18
-rw-r--r--services/blog/nuldoc-src/pages/PostListPage.tsx4
-rw-r--r--services/blog/nuldoc-src/pages/SlideListPage.tsx4
-rw-r--r--services/blog/nuldoc-src/pages/TagPage.tsx4
6 files changed, 42 insertions, 6 deletions
diff --git a/services/blog/nuldoc-src/components/PostPageEntry.tsx b/services/blog/nuldoc-src/components/PostPageEntry.tsx
index 2708b009..23ca88ac 100644
--- a/services/blog/nuldoc-src/components/PostPageEntry.tsx
+++ b/services/blog/nuldoc-src/components/PostPageEntry.tsx
@@ -5,8 +5,12 @@ import {
PostPage,
} from "../generators/post.ts";
import { dateToString } from "../revision.ts";
+import { Config } from "../config.ts";
+import TagList from "./TagList.tsx";
-export default function PostPageEntry({ post }: { post: PostPage }) {
+type Props = { post: PostPage; config: Config };
+
+export default function PostPageEntry({ post, config }: Props) {
return (
<article className="post-entry">
<a href={post.href}>
@@ -32,6 +36,9 @@ export default function PostPageEntry({ post }: { post: PostPage }) {
</time>
)}
{postHasAnyUpdates(post) && " 更新"}
+ {post.tags.length !== 0 && (
+ <TagList tags={post.tags} config={config} />
+ )}
</footer>
</a>
</article>
diff --git a/services/blog/nuldoc-src/components/SlidePageEntry.tsx b/services/blog/nuldoc-src/components/SlidePageEntry.tsx
index d2cf9a17..24017650 100644
--- a/services/blog/nuldoc-src/components/SlidePageEntry.tsx
+++ b/services/blog/nuldoc-src/components/SlidePageEntry.tsx
@@ -5,8 +5,12 @@ import {
} from "../generators/post.ts";
import { SlidePage } from "../generators/slide.ts";
import { dateToString } from "../revision.ts";
+import { Config } from "../config.ts";
+import TagList from "./TagList.tsx";
-export default function SlidePageEntry({ slide }: { slide: SlidePage }) {
+type Props = { slide: SlidePage; config: Config };
+
+export default function SlidePageEntry({ slide, config }: Props) {
return (
<article className="post-entry">
<a href={slide.href}>
@@ -32,6 +36,9 @@ export default function SlidePageEntry({ slide }: { slide: SlidePage }) {
</time>
)}
{postHasAnyUpdates(slide) && " 更新"}
+ {slide.tags.length !== 0 && (
+ <TagList tags={slide.tags} config={config} />
+ )}
</footer>
</a>
</article>
diff --git a/services/blog/nuldoc-src/components/TagList.tsx b/services/blog/nuldoc-src/components/TagList.tsx
new file mode 100644
index 00000000..86ee70bc
--- /dev/null
+++ b/services/blog/nuldoc-src/components/TagList.tsx
@@ -0,0 +1,18 @@
+import { Config, getTagLabel } from "../config.ts";
+
+type Props = {
+ tags: string[];
+ config: Config;
+};
+
+export default function TagList({ tags, config }: Props) {
+ return (
+ <ul className="entry-tags">
+ {tags.map((slug) => (
+ <li className="tag" key={slug}>
+ {getTagLabel(config, slug)}
+ </li>
+ ))}
+ </ul>
+ );
+}
diff --git a/services/blog/nuldoc-src/pages/PostListPage.tsx b/services/blog/nuldoc-src/pages/PostListPage.tsx
index 054955e6..b825f69d 100644
--- a/services/blog/nuldoc-src/pages/PostListPage.tsx
+++ b/services/blog/nuldoc-src/pages/PostListPage.tsx
@@ -39,7 +39,9 @@ export default function PostListPage(
basePath="/posts/"
/>
- {posts.map((post) => <PostPageEntry post={post} key={post.uuid} />)}
+ {posts.map((post) => (
+ <PostPageEntry post={post} config={config} key={post.uuid} />
+ ))}
<Pagination
currentPage={currentPage}
diff --git a/services/blog/nuldoc-src/pages/SlideListPage.tsx b/services/blog/nuldoc-src/pages/SlideListPage.tsx
index 3d87d492..bc4b895e 100644
--- a/services/blog/nuldoc-src/pages/SlideListPage.tsx
+++ b/services/blog/nuldoc-src/pages/SlideListPage.tsx
@@ -33,7 +33,9 @@ export default function SlideListPage(
if (ta > tb) return -1;
if (ta < tb) return 1;
return 0;
- }).map((slide) => <SlidePageEntry slide={slide} key={slide.uuid} />)}
+ }).map((slide) => (
+ <SlidePageEntry slide={slide} config={config} key={slide.uuid} />
+ ))}
</main>
<GlobalFooter config={config} />
</body>
diff --git a/services/blog/nuldoc-src/pages/TagPage.tsx b/services/blog/nuldoc-src/pages/TagPage.tsx
index 02c484af..b2ffba59 100644
--- a/services/blog/nuldoc-src/pages/TagPage.tsx
+++ b/services/blog/nuldoc-src/pages/TagPage.tsx
@@ -32,8 +32,8 @@ export default function TagPage(
</header>
{pages.map((page) =>
"event" in page
- ? <SlidePageEntry slide={page} key={page.uuid} />
- : <PostPageEntry post={page} key={page.uuid} />
+ ? <SlidePageEntry slide={page} config={config} key={page.uuid} />
+ : <PostPageEntry post={page} config={config} key={page.uuid} />
)}
</main>
<GlobalFooter config={config} />