import Link from "next/link"; import Image from "next/image"; import { ArrowRight, Calendar } from "lucide-react"; import { SectionHeading } from "../common/SectionHeading"; import { getLatestPosts } from "@/content/posts"; export function BlogPreview() { const latestPosts = getLatestPosts(3); const formatDate = (dateStr: string) => { const d = new Date(dateStr); return d.toLocaleDateString("pl-PL", { year: "numeric", month: "long", day: "numeric", }); }; const getCategoryLabel = (cat: string) => { const labels: Record = { klimatyzacja: "Klimatyzacja", "pompy-ciepla": "Pompy ciepła", porady: "Porady ogólne", }; return labels[cat] || cat; }; return (
{/* Blog Posts Grid */}
{latestPosts.map((post) => (
{/* Thumbnail */}
{post.title}
{/* Content */}
{/* Category & Date */}
{getCategoryLabel(post.category)} {formatDate(post.date)}
{/* Title */}

{post.title}

{/* Excerpt */}

{post.excerpt}

{/* Read More Link */}
Czytaj więcej
))}
{/* Blog Catalog Button */}
Przejdź do bloga
); }