blob: ee9460dcf93cedb24789f082380ad6b99ee5785b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import { h } from 'preact';
import { format as formatDate, parseISO } from 'date-fns';
import './Card.css';
export default function Card({ item }) {
return (
<article class="card">
<a
href={item.url}
style="text-decoration: none; color: initial; flex-grow: 1;"
>
{item.img ? (
<img
class="card-image card-image__sm"
src={item.img}
alt=""
style={{ background: item.imgBackground || undefined }}
/>
) : (
<div class="card-image card-image__sm"></div>
)}
<div class="card-text">
<h3 class="card-title">{item.title}</h3>
{item.date && (
<time class="snow-toc-link">
{formatDate(parseISO(item.date), 'MMMM d, yyyy')}
</time>
)}
{item.description && (
<p style="margin: 0.5rem 0 0.25rem;">{item.description}</p>
)}
</div>
</a>
</article>
);
}
|