tags refactor to component
This commit is contained in:
parent
8c425f89c8
commit
31fdc9a654
|
@ -0,0 +1,22 @@
|
|||
<script lang="ts">
|
||||
import type { Post } from '$lib/types/post';
|
||||
import { formatDate } from '$lib/utils/blog';
|
||||
|
||||
export let post: Post;
|
||||
</script>
|
||||
|
||||
<section class="flex-auto flex justify-between items-center py-4 px-2 m-8">
|
||||
{#if post.tags && post.tags.length > 0}
|
||||
<div class="flex mb-2 items-center gap-2">
|
||||
tags: {#each post.tags as tag}
|
||||
<a
|
||||
data-sveltekit-preload-data="hover"
|
||||
href="/{post.type}{new URLSearchParams({ tag }).toString()}"
|
||||
>
|
||||
<span class="chip variant-ghost-surface">{tag}</span>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<small>On {formatDate(post.datePublished)}</small>
|
||||
</section>
|
Loading…
Reference in New Issue