summaryrefslogtreecommitdiffhomepage
path: root/services/blog/nuldoc-src/components/PostPageEntry.tsx
blob: 23ca88acca40cd21f427b4bc03ebee2a670b1a23 (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
import {
  getPostPublishedDate,
  getPostUpdatedDate,
  postHasAnyUpdates,
  PostPage,
} from "../generators/post.ts";
import { dateToString } from "../revision.ts";
import { Config } from "../config.ts";
import TagList from "./TagList.tsx";

type Props = { post: PostPage; config: Config };

export default function PostPageEntry({ post, config }: Props) {
  return (
    <article className="post-entry">
      <a href={post.href}>
        <header className="entry-header">
          <h2>{post.title}</h2>
        </header>
        <section className="entry-content">
          <p>{post.description}</p>
        </section>
        <footer className="entry-footer">
          <time datetime={dateToString(getPostPublishedDate(post))}>
            {dateToString(getPostPublishedDate(post))}
          </time>
          {" 投稿"}
          {
            // TODO(jsx): support Fragment and merge them.
            postHasAnyUpdates(post) && "、"
          }
          {postHasAnyUpdates(post) &&
            (
              <time datetime={dateToString(getPostUpdatedDate(post))}>
                {dateToString(getPostUpdatedDate(post))}
              </time>
            )}
          {postHasAnyUpdates(post) && " 更新"}
          {post.tags.length !== 0 && (
            <TagList tags={post.tags} config={config} />
          )}
        </footer>
      </a>
    </article>
  );
}