"use client" import { Button } from "../ui/button" import { Markdown } from "../ui/markdown" import { Article } from "@/lib/content" import { getBackgroundImage } from "@/lib/utils" import Image from "next/image" import Link from "next/link" export const ArticleListCard = ({ article, lineClamp = false, }: { article: Article lineClamp?: boolean }) => { const url = `/blog/${article.id}` const formattedDate = new Date(article.date).toLocaleDateString("en-US", { month: "long", day: "numeric", year: "numeric", }) const tldr = lineClamp ? (article.tldr || "").replace(/\n/g, " ").substring(0, 120) + (article.tldr && article.tldr.length > 120 ? "..." : "") : article.tldr || "" const tags = article?.tags ?? [] const backgroundImage = getBackgroundImage(article?.image) const contentClassName = "font-sans text-sm text-tuatara-600 group-hover:text-primary duration-200 dark:text-tuatara-200" return (
{backgroundImage ? ( Article thumbnail ) : null}
{formattedDate}
{article.title} {(article?.authors ?? [])?.length > 0 && ( {article.authors?.map((author) => author).join(", ")} )}
( {children} ), h1: ({ children }) => (

{children}

), h2: ({ children }) => (

{children}

), h3: ({ children }) => (

{children}

), h4: ({ children }) => (

{children}

), h5: ({ children }) => (
{children}
), h6: ({ children }) => (
{children}
), p: ({ children }) => (

{children}

), img: ({ src, alt }) => null, }} > {tldr}
{tags?.length > 0 && (
{tags.slice(0, 5).map((tag) => ( ))}
)}
) }