Add image preview to news listing cards

This commit is contained in:
openhands committed 2026-07-07 19:10:32 +02:00
1 parent 8818d5364e
commit f86f73b128
1 file changed
+15
+15
View File
@@ -45,6 +45,20 @@ export default async function NewsPage() {
className="card hover" className="card hover"
style={{ display: "flex", flexDirection: "column" }} style={{ display: "flex", flexDirection: "column" }}
> >
{a.image ? (
<img
src={a.image}
alt=""
className="w-full rounded-t-lg"
style={{ aspectRatio: "16/9", objectFit: "cover" }}
/>
) : (
<div
className="w-full rounded-t-lg"
style={{ aspectRatio: "16/9", backgroundColor: "var(--color-surface)" }}
/>
)}
<div style={{ padding: "0.75rem" }}>
<h3 style={{ margin: "0 0 0.25rem", fontSize: "1rem" }}> <h3 style={{ margin: "0 0 0.25rem", fontSize: "1rem" }}>
<Link href={`/news/${a.slug}`}>{a.title}</Link> <Link href={`/news/${a.slug}`}>{a.title}</Link>
</h3> </h3>
@@ -52,6 +66,7 @@ export default async function NewsPage() {
{formatDate(a.createdAt)} {formatDate(a.createdAt)}
</p> </p>
<p style={{ margin: 0 }}>{excerpt(a.shortStory, 200)}</p> <p style={{ margin: 0 }}>{excerpt(a.shortStory, 200)}</p>
</div>
</article> </article>
))} ))}
</div> </div>