blog/lib/views/article.tsx

30 lines
900 B
TypeScript
Raw Normal View History

import { Document } from "asciidoctor";
import { DateTime } from "luxon";
2024-06-24 17:44:08 +00:00
import { asset } from "../assets.js";
type Props = {
2024-06-26 02:21:31 +00:00
article: Article;
body: string;
};
2024-06-26 02:21:31 +00:00
export type Article = { path: string; slug: string; date: DateTime; document: Document };
export default ({ article: { document, date }, body }: Props) => (
<>
<nav>
<a href="/" title="Back to home page">
<img src={asset("avatar.avif")} alt="Adædra's avatar" />
Adædra
</a>
</nav>
<article>
<header class="article-header">
{date.toLocaleString(DateTime.DATE_FULL)}
2024-06-26 02:21:31 +00:00
<h1 dangerouslySetInnerHTML={{ __html: document.getDocumentTitle() as string }} />
</header>
<a name="content" />
<main dangerouslySetInnerHTML={{ __html: body }} />
</article>
</>
);