forked from withastro/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlogPostPreview.astro
60 lines (51 loc) · 975 Bytes
/
BlogPostPreview.astro
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
import Author from './Author.astro';
export interface Props {
title: string;
publishDate: string;
href: string;
}
const { title, publishDate, href } = Astro.props;
---
<article class="post-preview">
<header>
<h3 class="publish-date">{publishDate}</h3>
<a href={href}><h1 class="title">{title}</h1></a>
</header>
<main>
<slot />{' '}<a href={href}>Read more →</a>
</main>
</article>
<style>
.content :global(main > * + *) {
margin-top: 1rem;
}
.post-preview {
padding-bottom: 2rem;
margin-bottom: 2rem;
border-bottom: 4px solid var(--theme-divider);
}
header {
display: flex;
flex-direction: column;
text-align: left;
align-items: flex-start;
justify-content: center;
padding-bottom: 2rem;
}
.title,
.author,
.publish-date {
margin: 0;
}
.publish-date,
.author {
font-size: 1.25rem;
color: var(--theme-text-lighter);
}
.title {
font-size: 2.25rem;
font-weight: 700;
color: var(--theme-text);
}
</style>