You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
779 B
TypeScript

import InfoBar from "~/components/InfoBar"
import { Post, getPostSlugs, loadSinglePage } from "~/utils/post"
export default async function Posts() {
const slugs = await getPostSlugs()
const posts = await Promise.all(slugs.map(loadSinglePage))
const sortedPosts = posts.sort((a: Post, b: Post) => b.date.valueOf() - a.date.valueOf())
return (
<>
<h1 className="pageTitle">
Posts
</h1>
<main>
{sortedPosts.map((post: Post) => (
<div className="mainColumn">
<InfoBar authorName={post.author} publishedDate={post.date} />
<h2>{post.title}</h2>
<p>{post.subtitle}</p>
<a href={`/posts/${post.slug}`}>Read Post =&gt;</a>
</div>
))}
</main>
</>
)
}