1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-01-23 13:19:36 +01:00
.profile/packages/blog/src/BlogPosts.tsx

43 lines
1.3 KiB
TypeScript
Raw Normal View History

import { Link } from "@repo/i18n/routing"
2024-07-31 11:41:39 +02:00
import { Typography } from "@repo/ui/Design/Typography"
import { Section, SectionContent } from "@repo/ui/Layout/Section"
import { getISODate } from "@repo/utils/dates"
2024-09-11 23:53:26 +02:00
import type { BlogPost } from "./BlogPost.tsx"
export interface BlogPostsProps {
posts: BlogPost[]
}
export const BlogPosts: React.FC<BlogPostsProps> = (props) => {
const { posts } = props
return (
<ul className="list-none">
{posts.map((post) => {
const postPublishedOn = getISODate(
new Date(post.frontmatter.publishedOn),
)
return (
<li key={post.slug}>
<Link href={`/blog/${post.slug}`}>
<Section verticalSpacing>
<SectionContent
className="cursor-pointer p-6 transition-all duration-300 ease-in-out hover:scale-[1.02] sm:p-6"
shadowContainer
>
<Typography variant="h4" as="h3">
{post.frontmatter.title}
</Typography>
<p className="mt-2">{postPublishedOn}</p>
<p className="mt-3">{post.frontmatter.description}</p>
</SectionContent>
</Section>
</Link>
</li>
)
})}
</ul>
)
}