From e0a8e1b595dd5a636f49edce7c08b2fd12c1e452 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 21 Jun 2025 15:03:29 +0900 Subject: feat(blog/nuldoc): implement pagination --- vhosts/blog/nuldoc-src/pages/PostListPage.tsx | 37 ++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'vhosts/blog/nuldoc-src/pages/PostListPage.tsx') diff --git a/vhosts/blog/nuldoc-src/pages/PostListPage.tsx b/vhosts/blog/nuldoc-src/pages/PostListPage.tsx index c1c5214c..054955e6 100644 --- a/vhosts/blog/nuldoc-src/pages/PostListPage.tsx +++ b/vhosts/blog/nuldoc-src/pages/PostListPage.tsx @@ -1,22 +1,28 @@ import GlobalFooter from "../components/GlobalFooter.tsx"; import GlobalHeader from "../components/GlobalHeader.tsx"; import PageLayout from "../components/PageLayout.tsx"; +import Pagination from "../components/Pagination.tsx"; import PostPageEntry from "../components/PostPageEntry.tsx"; import { Config } from "../config.ts"; -import { dateToString } from "../revision.ts"; -import { getPostPublishedDate, PostPage } from "../generators/post.ts"; +import { PostPage } from "../generators/post.ts"; export default function PostListPage( posts: PostPage[], config: Config, + currentPage: number, + totalPages: number, ) { const pageTitle = "投稿一覧"; + const pageInfoSuffix = ` (${currentPage}ページ目)`; + const metaTitle = `${pageTitle}${pageInfoSuffix}|${config.blog.siteName}`; + const metaDescription = `投稿した記事の一覧${pageInfoSuffix}`; + return ( @@ -24,15 +30,22 @@ export default function PostListPage(
-

{pageTitle}

+

{pageTitle}{pageInfoSuffix}

- {Array.from(posts).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((post) => )} + + + + {posts.map((post) => )} + +
-- cgit v1.2.3-70-g09d2