summaryrefslogtreecommitdiffhomepage
path: root/services/blog/nuldoc-src/pages/PostListPage.tsx
blob: b825f69d4b03a062aa6bed3eeb5ce4008a4cd709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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 { 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 (
    <PageLayout
      metaCopyrightYear={config.blog.siteCopyrightYear}
      metaDescription={metaDescription}
      metaTitle={metaTitle}
      metaAtomFeedHref={`https://${config.blog.fqdn}/posts/atom.xml`}
      config={config}
    >
      <body className="list">
        <GlobalHeader config={config} />
        <main className="main">
          <header className="page-header">
            <h1>{pageTitle}{pageInfoSuffix}</h1>
          </header>

          <Pagination
            currentPage={currentPage}
            totalPages={totalPages}
            basePath="/posts/"
          />

          {posts.map((post) => (
            <PostPageEntry post={post} config={config} key={post.uuid} />
          ))}

          <Pagination
            currentPage={currentPage}
            totalPages={totalPages}
            basePath="/posts/"
          />
        </main>
        <GlobalFooter config={config} />
      </body>
    </PageLayout>
  );
}