diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-03-19 01:20:16 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-03-19 01:30:08 +0900 |
| commit | cb5a2a0afdf822651db035904cd8c1307a7b7743 (patch) | |
| tree | 626ad303be1d53cbcc837d5c5213740a19ac19c4 /nuldoc-src/components/post_page_entry.ts | |
| parent | ee4f41927c0d83a38b92b99071a64eec01f00413 (diff) | |
| download | blog.nsfisis.dev-cb5a2a0afdf822651db035904cd8c1307a7b7743.tar.gz blog.nsfisis.dev-cb5a2a0afdf822651db035904cd8c1307a7b7743.tar.zst blog.nsfisis.dev-cb5a2a0afdf822651db035904cd8c1307a7b7743.zip | |
refactor: move shared components to components/*
Diffstat (limited to 'nuldoc-src/components/post_page_entry.ts')
| -rw-r--r-- | nuldoc-src/components/post_page_entry.ts | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/nuldoc-src/components/post_page_entry.ts b/nuldoc-src/components/post_page_entry.ts new file mode 100644 index 0000000..e825dfd --- /dev/null +++ b/nuldoc-src/components/post_page_entry.ts @@ -0,0 +1,47 @@ +import { el, Element, text } from "../dom.ts"; +import { + getPostCreatedDate, + getPostUpdatedDate, + PostPage, +} from "../pages/post.ts"; + +export function postPageEntry(post: PostPage): Element { + return el( + "article", + [["class", "post-entry"]], + el( + "a", + [["href", post.href]], + el( + "header", + [["class", "entry-header"]], + el("h2", [], text(post.title)), + ), + el( + "section", + [["class", "entry-content"]], + el("p", [], text(post.summary)), + ), + el( + "footer", + [["class", "entry-footer"]], + el( + "time", + [["datetime", getPostCreatedDate(post)]], + text(getPostCreatedDate(post)), + ), + text(" 投稿"), + ...(post.revisions.length > 1 + ? [ + text("、"), + el("time", [[ + "datetime", + getPostUpdatedDate(post), + ]], text(getPostUpdatedDate(post))), + text(" 更新"), + ] + : []), + ), + ), + ); +} |
