2022-08-10 16:31:25 -04:00
|
|
|
<script setup lang="ts">
|
2023-05-24 12:25:31 -04:00
|
|
|
import type { AnyParsedContent } from "@/shared/types";
|
2022-12-01 01:24:26 -05:00
|
|
|
import { calcReadingTime } from "@/shared/metadata";
|
2023-11-19 01:19:43 -05:00
|
|
|
import { SpecialTags } from "@/data/specialTags";
|
|
|
|
import IconStar from "@/assets/images/star.svg?component";
|
2022-08-10 16:31:25 -04:00
|
|
|
|
2023-01-28 15:32:48 -05:00
|
|
|
const props = defineProps<{
|
2023-05-24 12:25:31 -04:00
|
|
|
post: AnyParsedContent;
|
2022-08-10 16:31:25 -04:00
|
|
|
type: "stories" | "blog";
|
|
|
|
highlighttags?: string[];
|
|
|
|
}>();
|
|
|
|
|
2023-01-28 15:32:48 -05:00
|
|
|
const readingTime = calcReadingTime(props.post);
|
2022-08-10 16:31:25 -04:00
|
|
|
const descText =
|
2023-01-28 15:32:48 -05:00
|
|
|
props.type === "stories"
|
2022-08-10 16:31:25 -04:00
|
|
|
? `${readingTime.words.total} words`
|
|
|
|
: `${readingTime.minutes} min read`;
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-05-24 12:23:45 -04:00
|
|
|
<div
|
2023-05-24 12:33:50 -04:00
|
|
|
class="break-words max-w-full rounded-lg p-4 shadow-md border border-2 border-gray-300 dark:border-gray-600"
|
2023-05-24 12:23:45 -04:00
|
|
|
>
|
2023-11-19 01:19:43 -05:00
|
|
|
<h3 class="m-0 flex items-center gap-1.5">
|
2024-02-29 18:38:15 -05:00
|
|
|
<a
|
|
|
|
:href="`/tags/${props.type}/featured`"
|
|
|
|
v-if="post.tags.includes('featured')"
|
|
|
|
>
|
2023-11-29 13:39:04 -05:00
|
|
|
<IconStar class="fill-yellow-500 outline-none" />
|
|
|
|
</a>
|
2022-08-10 16:31:25 -04:00
|
|
|
<a
|
|
|
|
:href="post._path"
|
|
|
|
class="no-underline text-left text-2xl sm:text-2xl font-bold hover:text-blue-700 dark:hover:text-blue-400 leading-tight transition"
|
|
|
|
>
|
|
|
|
{{ post.title }}
|
|
|
|
</a>
|
|
|
|
</h3>
|
2022-12-01 01:24:26 -05:00
|
|
|
<p class="my-1 text-sm"><Date :doc="post" /> · {{ descText }}</p>
|
2022-08-10 16:31:25 -04:00
|
|
|
<div class="flex flex-wrap">
|
2023-11-19 01:19:43 -05:00
|
|
|
<template v-for="(tag, index) in post.tags" :key="index">
|
2024-02-29 18:38:15 -05:00
|
|
|
<Tag
|
|
|
|
:dest="`/tags/${type}/${tag}`"
|
|
|
|
:name="tag"
|
|
|
|
:highlight="highlighttags?.includes(tag)"
|
|
|
|
v-if="!SpecialTags.includes(tag)"
|
|
|
|
/>
|
2023-11-19 01:19:43 -05:00
|
|
|
</template>
|
2022-08-10 16:31:25 -04:00
|
|
|
</div>
|
2023-01-11 15:14:47 -05:00
|
|
|
<ContentRenderer :value="post" :excerpt="true" tag="section">
|
2022-08-10 16:31:25 -04:00
|
|
|
<template #empty>No excerpt available.</template>
|
|
|
|
</ContentRenderer>
|
2022-08-10 16:50:03 -04:00
|
|
|
<div class="text-right" v-if="!post.nopreview">
|
2022-08-10 16:31:25 -04:00
|
|
|
<a
|
|
|
|
:href="post._path"
|
|
|
|
class="no-underline hover:underline font-semibold text-blue-700 dark:text-blue-400"
|
|
|
|
>
|
|
|
|
Continue reading →
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|