feat: Add summary card to note components

This commit is contained in:
KazooTTT
2025-02-14 15:41:27 +08:00
parent 902d84dded
commit cd6388c0d6

View File

@ -7,6 +7,7 @@ import ArticleContainer from "../ArticleContainer.astro";
import ShareButtons from "../ShareButtons.astro"; import ShareButtons from "../ShareButtons.astro";
import ContentFooter from "../ContentFooter.astro"; import ContentFooter from "../ContentFooter.astro";
import { cn } from "@/utils/tailwind"; import { cn } from "@/utils/tailwind";
import Card from "../componentsBefore/Card.astro";
type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & { type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
note: CollectionEntry<"note">; note: CollectionEntry<"note">;
isPreview?: boolean | undefined; isPreview?: boolean | undefined;
@ -77,6 +78,13 @@ if (modifiedDate && modifiedDate.toDateString() === date.toDateString()) {
enableLineClamp && "line-clamp-4" enableLineClamp && "line-clamp-4"
)} )}
> >
{
isPreview && note.data.description && note.data.description.trim().length > 0 && (
<Card heading="摘要由llm生成" altText="摘要" class="my-4 w-full">
<div class="text-muted-foreground ml-4">{note.data.description}</div>
</Card>
)
}
<Content /> <Content />
</div> </div>
</div> </div>