Files
Blog/src/frontend/pages/post.tsx
Caleb Braaten f46f4667a1 Complete WIP: Architecture refactor.
Mount JSX server side templating for blog posts. Send AppShell conditionally. Maintain support for HMR via HTMLbundles using Bun's native fullstack dev server under an /hmr path. This is only mounted in development and is supported by the onImport Bun plugin. Add DB creation on startup and load pages based on those records.
2026-01-08 05:35:59 -08:00

46 lines
1.2 KiB
TypeScript

import React from 'react';
interface PostProps {
// HTML string for the blog post body
children: string;
meta: {
title: string;
date: Date;
readingTime: string;
};
}
export function Post({ children, meta }: PostProps) {
return (
<main>
<article className="blog-post">
<header className="post-header">
<h1>{meta.title}</h1>
<div className="post-meta">
{meta.date && meta.date instanceof Date &&
<>
<time dateTime={meta.date.toISOString()}>
{meta.date.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
})}
</time>
</>
}
{meta.readingTime &&
<>
<span className="meta-separator"></span>
<span>{meta.readingTime}</span>
</>
}
</div>
</header>
<div className="post-content" dangerouslySetInnerHTML={{ __html: children }} />
</article>
</main>
)
}