aboutsummaryrefslogtreecommitdiffhomepage
path: root/services/nuldoc/nuldoc-src/components/PostPageEntry.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'services/nuldoc/nuldoc-src/components/PostPageEntry.tsx')
-rw-r--r--services/nuldoc/nuldoc-src/components/PostPageEntry.tsx46
1 files changed, 46 insertions, 0 deletions
diff --git a/services/nuldoc/nuldoc-src/components/PostPageEntry.tsx b/services/nuldoc/nuldoc-src/components/PostPageEntry.tsx
new file mode 100644
index 0000000..23ca88a
--- /dev/null
+++ b/services/nuldoc/nuldoc-src/components/PostPageEntry.tsx
@@ -0,0 +1,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>
+ );
+}