import React from 'react'; import Link from 'next/link'; import { getAllPosts } from '@/lib/blog'; import { getTranslations } from 'next-intl/server'; import { Section, Container, Heading, Card, Badge } from '../../components/ui'; interface RecentPostsProps { locale: string; } export default async function RecentPosts({ locale }: RecentPostsProps) { const posts = await getAllPosts(locale); const recentPosts = posts.slice(0, 3); if (recentPosts.length === 0) return null; return (
{locale === 'de' ? 'Aktuelle Blogbeiträge' : 'Recent Blog Posts'} {locale === 'de' ? 'Alle Beiträge ansehen' : 'View all posts'}
{recentPosts.map((post) => ( {post.frontmatter.featuredImage && (
{post.frontmatter.title}
{post.frontmatter.category && ( {post.frontmatter.category} )}
)}
{new Date(post.frontmatter.date).toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' })}

{post.frontmatter.title}

{locale === 'de' ? 'Weiterlesen' : 'Read more'}
))}
); }