feat: show counts

This commit is contained in:
KazooTTT
2025-02-05 23:02:29 +08:00
parent af1372b1b8
commit 8e3e1d5834
3 changed files with 24 additions and 12 deletions

View File

@ -6,9 +6,10 @@ import GiscusComment from "@/components/componentsBefore/GiscusComment";
type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }> & {
note: CollectionEntry<"note">;
isPreview?: boolean | undefined;
index?: number;
};
const { as: Tag = "div", note, isPreview = false } = Astro.props;
const { as: Tag = "div", note, isPreview = false, index } = Astro.props;
const { Content } = await render(note);
const dateTimeOptions: Intl.DateTimeFormatOptions = note.data.date_created
? {
@ -37,9 +38,12 @@ const date = note.data.date_created ?? note.data.date;
<Tag class="title" class:list={{ "text-base": isPreview }}>
{
isPreview ? (
<a class="cactus-link" href={`/notes/${note.id}/`}>
{note.data.title}
</a>
<>
{index + 1}.{" "}
<a class="cactus-link" href={`/notes/${note.id}/`}>
{note.data.title}
</a>
</>
) : (
<>{note.data.title}</>
)