Skip to content

Commit a7ecda6

Browse files
committed
feat: added post preview component
1 parent e7cf22b commit a7ecda6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
import type { CollectionEntry } from 'astro:content';
3+
import { formatDate } from '@/lib/utils';
4+
import { render } from 'astro:content';
5+
interface Props {
6+
entry: CollectionEntry<'posts'>;
7+
}
8+
9+
const { entry } = Astro.props;
10+
const { remarkPluginFrontmatter } = await render(entry);
11+
---
12+
13+
<li class="py-2">
14+
<div class="flex gap-5">
15+
<div class="relative min-w-22 shrink-0">
16+
<span class="text-muted-foreground text-sm">{formatDate(entry.data.date)}</span>
17+
</div>
18+
<a href={`/writing/${entry.id}/`} class="flex flex-col gap-3">
19+
<div class="flex flex-col">
20+
<span class="text-headings font-medium">{entry.data.title}</span>
21+
<span class="text-muted-foreground">{remarkPluginFrontmatter.minutesRead}</span>
22+
</div>
23+
</a>
24+
</div>
25+
</li>

0 commit comments

Comments
 (0)