Add image preview to news listing cards
This commit is contained in:
1 parent
8818d5364e
commit
f86f73b128
1 file changed
+22
-7
+22
-7
@@ -45,13 +45,28 @@ export default async function NewsPage() {
|
||||
className="card hover"
|
||||
style={{ display: "flex", flexDirection: "column" }}
|
||||
>
|
||||
<h3 style={{ margin: "0 0 0.25rem", fontSize: "1rem" }}>
|
||||
<Link href={`/news/${a.slug}`}>{a.title}</Link>
|
||||
</h3>
|
||||
<p className="muted" style={{ margin: "0 0 0.5rem", fontSize: "0.85rem" }}>
|
||||
{formatDate(a.createdAt)}
|
||||
</p>
|
||||
<p style={{ margin: 0 }}>{excerpt(a.shortStory, 200)}</p>
|
||||
{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" }}>
|
||||
<Link href={`/news/${a.slug}`}>{a.title}</Link>
|
||||
</h3>
|
||||
<p className="muted" style={{ margin: "0 0 0.5rem", fontSize: "0.85rem" }}>
|
||||
{formatDate(a.createdAt)}
|
||||
</p>
|
||||
<p style={{ margin: 0 }}>{excerpt(a.shortStory, 200)}</p>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user