This repository has been archived on 2025-02-18. You can view files and clone it, but cannot push or open issues or pull requests.
Naomi Carrigan 2a30268701
All checks were successful
Node.js CI / Lint and Test (push) Successful in 1m13s
feat: setup actions (#1)
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
2025-01-23 02:04:03 -08:00

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;