@@ -3,13 +3,14 @@ import type { CollectionEntry } from 'astro:content'
3
3
import { getMonthName } from ' $/utils'
4
4
5
5
interface Props {
6
- post: CollectionEntry <' blog' >
6
+ post: CollectionEntry <' blog' >,
7
+ asCard? : boolean
7
8
}
8
9
9
- const { post : { data : post, slug } } = Astro .props
10
+ const { post : { data : post, slug }, asCard = false } = Astro .props
10
11
---
11
- <div class =" post-preview" >
12
- <div class =" sm:w-20 md:w-32 " >
12
+ <div class ={ ` post-preview ${ asCard && ' post-preview--card ' } ` } >
13
+ <div class =" post-preview__date-box " >
13
14
<div class =" post-preview__date" >
14
15
<span class =" post-preview__date__day" >{ new Date (post .date ).getDate () } </span >
15
16
<span class =" post-preview__date__month-n-year" >{ ` ${getMonthName (post .date )} ${new Date (post .date ).getFullYear ()} ` } </span >
@@ -26,14 +27,29 @@ const { post: { data: post, slug } } = Astro.props
26
27
</div >
27
28
<style >
28
29
.post-preview {
29
- @apply flex gap-6;
30
+ @apply flex gap-6;
31
+ }
32
+ .post-preview--card {
33
+ @apply flex flex-col-reverse gap-4 sm:w-72 md:w-60 lg:w-64;
34
+ }
35
+ .post-preview__date-box {
36
+ @apply sm:w-20 md:w-32
37
+ }
38
+ .post-preview--card .post-preview__date-box {
39
+ @apply w-full
30
40
}
31
41
.post-preview__date {
32
42
@apply flex flex-col w-full text-center;
33
43
}
44
+ .post-preview--card .post-preview__date {
45
+ @apply text-left flex flex-row gap-1
46
+ }
34
47
.post-preview__date__day {
35
48
@apply text-6xl font-semibold text-gray-500 dark:text-gray-300;
36
49
}
50
+ .post-preview--card .post-preview__date__day {
51
+ @apply text-4xl
52
+ }
37
53
.post-preview__date__month-n-year {
38
54
@apply text-gray-400;
39
55
}
0 commit comments