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

export default function PostPageEntry({ post }: { post: PostPage }) {
  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) && " 更新"}
        </footer>
      </a>
    </article>
  );
}