summaryrefslogtreecommitdiffhomepage
path: root/services/blog/nuldoc-src/components/SlidePageEntry.tsx
blob: 24017650f2c7425802446915e594ea7f2f8adc0d (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,
} 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";

type Props = { slide: SlidePage; config: Config };

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