website/src/lib/BlogCard/Meta.svelte

25 lines
1.1 KiB
Svelte
Raw Normal View History

2023-01-01 13:52:26 +05:30
<script lang="ts">
import dayjs from "dayjs";
export let post: any;
2023-01-03 14:17:39 +05:30
export let isPost: boolean = false;
2023-01-01 13:52:26 +05:30
</script>
2023-01-03 14:17:39 +05:30
<div class="flex flex-col gap-2 flex-1 {isPost ? "nav:(flex-row gap-4)" : ""}">
2023-01-01 13:52:26 +05:30
{#if post.tags.length > 0}
<div class="flex flex-row items-center gap-2">
<div class="i-ic:outline-bookmarks text-xl -ml-1" />
2023-01-01 13:52:26 +05:30
{#each post.tags as tag}
2023-01-25 22:41:11 +05:30
<a href="/blog/tags/{tag.slug}" class="no-underline rounded p-1 {isPost ? "bg-secondary" : "bg-primary"}">{tag.name}</a>
2023-01-01 13:52:26 +05:30
{/each}
</div>
{/if}
{#each post.authors as author}
<a href="/blog/authors/{author.slug}" class="flex items-center gap-2 no-underline"><div class="i-ic:outline-person text-xl -ml-1" />{author.name}</a>
2023-01-01 13:52:26 +05:30
{/each}
<span class="flex items-center gap-2"><div class="i-ic:outline-calendar-month text-xl -ml-1" /> {dayjs
2023-01-01 13:52:26 +05:30
(post.published_at)
.format("ddd, DD MMM YYYY HH:mm")}</span>
<span class="flex items-center gap-2"><div class="i-ic:outline-edit text-2xl -ml-1" /> {post.plaintext.trim().split(/\s+/).length} words</span>
<span class="flex items-center gap-2"><div class="i-ic:outline-import-contacts text-xl -ml-1" /> {post.reading_time} minute read</span>
2023-01-01 13:52:26 +05:30
</div>