summaryrefslogtreecommitdiff
path: root/examples/blog/src/components/BlogPostPreview.astro
blob: 865eeeb7f7e6d4ca4439578f0405717b146cccd5 (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
37
38
39
40
41
42
43
---
export interface Props {
	title: string;
	description: string;
	publishDate: string;
	url: string;
}

const { title, description, publishDate, url } = Astro.props as Props;
---

<article class="post-preview">
	<header>
		<time>{publishDate}</time>
		<a href={url}><h1 class="title">{title}</h1></a>
	</header>
	<p>{description}</p>
	<a href={url}>Read more</a>
</article>

<style>
	.post-preview {
		padding-bottom: 2rem;
		margin-bottom: 2rem;
		border-bottom: 4px solid var(--theme-divider);
	}

	.title,
	time {
		margin: 0;
	}

	time {
		font-size: 1.25rem;
		color: var(--theme-text-lighter);
	}

	.title {
		font-size: 2.25rem;
		font-weight: 700;
		color: var(--theme-text);
	}
</style>