This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
---
|
||||
import markdownToText from "@helpers/markdownToText";
|
||||
import { useTranslatedPath } from "@i18n/utils";
|
||||
import type { InferEntrySchema } from "astro:content";
|
||||
|
||||
const tp = useTranslatedPath(Astro.url);
|
||||
|
||||
interface Props {
|
||||
post: {
|
||||
data: {
|
||||
title: string;
|
||||
description?: string;
|
||||
icon?: string;
|
||||
tags?: string[];
|
||||
};
|
||||
data: InferEntrySchema<"blog">;
|
||||
collection: string;
|
||||
body: string;
|
||||
slug: string;
|
||||
body?: string;
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,15 +18,14 @@ const { post } = Astro.props;
|
||||
---
|
||||
|
||||
<div class="rounded-diag-md border border-neutral p-4 overflow-hidden">
|
||||
<a href={tp(`/${post.collection}/${post.slug.split("/")[0]}`)}>
|
||||
<a href={tp(`/${post.collection}/${post.id.split("/")[0]}`)}>
|
||||
<h2
|
||||
class="text-2xl flex gap-2 items-center line-clamp text-ellipsis overflow-hidden"
|
||||
>
|
||||
class="text-2xl flex gap-2 items-center line-clamp text-ellipsis overflow-hidden">
|
||||
{post.data.icon && <img src={post.data.icon} class="h-6" />}
|
||||
{post.data.title}
|
||||
</h2>
|
||||
<p class="text-ellipsis overflow-hidden line-clamp-2">
|
||||
{post.data.description || markdownToText(post.body).slice(0, 200)}
|
||||
{post.data.description || markdownToText(post?.body || "").slice(0, 200)}
|
||||
</p>
|
||||
</a>
|
||||
{
|
||||
@@ -39,8 +34,7 @@ const { post } = Astro.props;
|
||||
{post.data.tags.map((tag) => (
|
||||
<a
|
||||
href={tp(`/tag/${tag}`)}
|
||||
class="text-xs border border-neutral p-2 rounded-md"
|
||||
>
|
||||
class="text-xs border border-neutral p-2 rounded-md">
|
||||
{tag}
|
||||
</a>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user