import Link from "next/link"; import { FitList } from "./fit-list"; import { Chevron } from "./ui"; import { formatDate, localePath, type Locale } from "@/lib/i18n"; import { getMessages } from "@/messages"; export type PostSummary = { id: string; title: string; createdAt: string | null; }; export function WritingCard({ posts, lang, }: { posts: PostSummary[]; lang: Locale; }) { const t = getMessages(lang); const fmt = (iso: string | null) => iso ? formatDate(lang, iso, { month: "short", year: "numeric" }) : ""; return (

{t.writing.title}

{t.writing.all}
{/* As many posts as the card has room for; the rows that show share out the spare height, so the list always ends at the card's inset. Rows never shrink, so FitList can see which ones overflow. */} {posts.slice(0, 10).map((p) => (
  • {p.title}
  • ))} {posts.length === 0 && (
  • {t.writing.readBlog}
  • )}
    ); }