-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathCard.astro
More file actions
43 lines (41 loc) · 1000 Bytes
/
Card.astro
File metadata and controls
43 lines (41 loc) · 1000 Bytes
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
37
38
39
40
41
42
43
---
export interface Props {
title: string
body: string
href: string
tags: {
title: string
metadata: {
color?: string
}
}[]
}
const { href, title, body, tags } = Astro.props
---
<li class="rounded-md bg-white shadow-md transition hover:shadow-xl">
<a href={`/blog/${href}`}>
<div class="flex h-full flex-col gap-y-2 p-6">
<h2 class="pr-4 pt-2 text-xl font-semibold">
{title}
</h2>
<p>
{body}
</p>
{
tags && (
<div class="flex flex-wrap gap-1">
{tags?.map(
(tag: { title: string; metadata: { color?: string } }) => (
<span
class="w-fit whitespace-nowrap rounded-md bg-black px-2 text-sm font-bold text-white shadow transition"
style={`background-color: ${tag.metadata?.color}`}>
{tag.title}
</span>
)
)}
</div>
)
}
</div>
</a>
</li>