Add themed header bar and image preview to news article cards
This commit is contained in:
1 parent
f86f73b128
commit
63e1e6a44e
1 file changed
+20
-13
+20
-13
@@ -40,34 +40,41 @@ export default async function NewsPage() {
|
|||||||
) : (
|
) : (
|
||||||
<div className="card-grid sm-2 lg-3" style={{ padding: "1rem" }}>
|
<div className="card-grid sm-2 lg-3" style={{ padding: "1rem" }}>
|
||||||
{articles.map((a) => (
|
{articles.map((a) => (
|
||||||
<article
|
<Link
|
||||||
key={a.slug}
|
key={a.slug}
|
||||||
|
href={`/news/${a.slug}`}
|
||||||
className="card hover"
|
className="card hover"
|
||||||
style={{ display: "flex", flexDirection: "column" }}
|
style={{ display: "flex", flexDirection: "column", textDecoration: "none" }}
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
background: "linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 10%, var(--color-surface)), color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)))",
|
||||||
|
borderBottom: "1px solid color-mix(in srgb, var(--color-text-muted) 8%, transparent)",
|
||||||
|
padding: "0.6rem 0.75rem",
|
||||||
|
fontSize: "0.78rem",
|
||||||
|
color: "var(--color-text-muted)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
📰 {t("title")} · {formatDate(a.createdAt)}
|
||||||
|
</div>
|
||||||
{a.image ? (
|
{a.image ? (
|
||||||
<img
|
<img
|
||||||
src={a.image}
|
src={a.image}
|
||||||
alt=""
|
alt=""
|
||||||
className="w-full rounded-t-lg"
|
style={{ width: "100%", aspectRatio: "16/9", objectFit: "cover" }}
|
||||||
style={{ aspectRatio: "16/9", objectFit: "cover" }}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
className="w-full rounded-t-lg"
|
style={{ width: "100%", aspectRatio: "16/9", backgroundColor: "var(--color-surface)" }}
|
||||||
style={{ aspectRatio: "16/9", backgroundColor: "var(--color-surface)" }}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div style={{ padding: "0.75rem" }}>
|
<div style={{ padding: "0.75rem" }}>
|
||||||
<h3 style={{ margin: "0 0 0.25rem", fontSize: "1rem" }}>
|
<h3 style={{ margin: "0 0 0.25rem", fontSize: "1rem", color: "var(--color-text)" }}>
|
||||||
<Link href={`/news/${a.slug}`}>{a.title}</Link>
|
{a.title}
|
||||||
</h3>
|
</h3>
|
||||||
<p className="muted" style={{ margin: "0 0 0.5rem", fontSize: "0.85rem" }}>
|
<p style={{ margin: 0, color: "var(--color-text)" }}>{excerpt(a.shortStory, 200)}</p>
|
||||||
{formatDate(a.createdAt)}
|
|
||||||
</p>
|
|
||||||
<p style={{ margin: 0 }}>{excerpt(a.shortStory, 200)}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user