more refactors
This commit is contained in:
18
web/src/components/postList/postCard.astro
Normal file
18
web/src/components/postList/postCard.astro
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
import { getFormattedDate } from "@utils/date"
|
||||
import { authPB } from "@utils/pocketbase"
|
||||
|
||||
const pb = await authPB()
|
||||
const { p } = Astro.props
|
||||
---
|
||||
|
||||
<div class="mb-5 w-2/3">
|
||||
<time datetime={p['publishDate']} class="min-w-[120px] text-gray-500">{getFormattedDate(p['publishDate'])}</time>
|
||||
<div>
|
||||
<a href={`/posts/${p['slug']}/`} rel="prefetch">
|
||||
<img src={ pb.files.getURL(p, p.headerImage) } class="rounded-xl border-12 border-white"/>
|
||||
{p['title']}
|
||||
</a>
|
||||
</div>
|
||||
<q class="line-clamp-3 block italic">{p['description']}</q>
|
||||
</div>
|
||||
21
web/src/components/postList/tagList.astro
Normal file
21
web/src/components/postList/tagList.astro
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
const { tags } = Astro.props
|
||||
---
|
||||
|
||||
<p class="text-xl mt-4">Tags</p>
|
||||
{
|
||||
tags.length && (
|
||||
<ul class="flex flex-wrap gap-2">
|
||||
{tags.map(tag => (
|
||||
<li>
|
||||
<a
|
||||
href={`/posts/tag/${tag}/`}
|
||||
aria-label={`View all posts with the tag: ${tag}`}
|
||||
>
|
||||
#{tag}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user