public/components/BlogStatBox.vue

58 lines
1.4 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import type { BlogParsedContent } from "@/shared/types";
import { calcReadingTime } from "@/shared/metadata";
const docs = await queryContent<BlogParsedContent>("/blog")
.sort({ date: 1 })
.where({ _draft: false })
.find();
2022-08-09 15:37:32 -04:00
const latest = docs.at(-1) as BlogParsedContent;
</script>
<template>
2023-01-28 15:59:29 -05:00
<div class="prose dark:prose-invert flex onhover">
<HomeStatBox
:href="latest._path"
color="lightblue"
2022-08-09 16:25:23 -04:00
darkcolor="#497482"
title="Latest blog post"
>
<h2 class="m-0 mt-4 mb-1">{{ latest.title }}</h2>
2022-08-09 16:25:23 -04:00
<p class="text-sm text-gray-500 dark:text-gray-400 m-0">
<Date :doc="latest" /> · {{ calcReadingTime(latest).minutes }} min read
</p>
<div class="tag-list mt-1">
2022-08-08 18:41:29 -04:00
<Tag
v-for="(tag, index) in latest.tags"
:key="index"
2022-08-10 16:31:25 -04:00
:dest="`/tags/blog/${tag}`"
2022-08-08 18:41:29 -04:00
>
{{ tag }}
</Tag>
</div>
<ContentRenderer
tag="article"
:value="latest"
:excerpt="true"
2022-08-10 16:31:25 -04:00
class="text-gray-600 dark:text-gray-300 text-base m-0 mt-5"
>
<ContentRendererMarkdown :value="latest" :excerpt="true" />
<template #empty>
<p>No description found.</p>
</template>
</ContentRenderer>
</HomeStatBox>
</div>
</template>
2022-08-09 21:12:49 -04:00
2023-01-28 15:59:29 -05:00
<style scoped lang="scss">
2022-08-09 21:12:49 -04:00
h2 {
overflow-wrap: break-word;
}
2023-01-28 15:59:29 -05:00
div.onhover:hover h2 {
@apply text-blue-700 dark:text-blue-400;
}
2022-08-09 21:12:49 -04:00
</style>