generated from nhcarrigan/template
All checks were successful
Node.js CI / Lint and Test (push) Successful in 1m13s
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
/**
|
|
* @copyright nhcarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
|
|
import Markdown from "react-markdown";
|
|
import remarkGfm from "remark-gfm";
|
|
import type { JSX } from "react";
|
|
import { Rule } from "@/components/rule";
|
|
import { getPostData } from "@/lib/posts";
|
|
|
|
/**
|
|
* Renders a blog post.
|
|
* @param props - The properties of the page.
|
|
* @param props.params - The path parameters.
|
|
* @returns The JSX component.
|
|
*/
|
|
const Page = async({
|
|
params,
|
|
}: {
|
|
readonly params: Promise<{ slug: string }>;
|
|
}): Promise<JSX.Element> => {
|
|
const { slug } = await params;
|
|
const post = getPostData(slug);
|
|
return (
|
|
<main>
|
|
<h1>{post.data.title}</h1>
|
|
<p className="italic text-center">{`Published ${post.data.date.toLocaleDateString("en-GB", { day: "numeric", month: "long", weekday: "long", year: "numeric" })}`}</p>
|
|
<Rule />
|
|
<Markdown remarkPlugins={[ remarkGfm ]}>{post.content}</Markdown>
|
|
<Rule />
|
|
<a href="/">{"← Back to home"}</a>
|
|
</main>
|
|
);
|
|
};
|
|
|
|
export default Page;
|