feat: Enhance notes display with multi-column layout and line clamping

This commit is contained in:
KazooTTT
2025-02-10 17:34:39 +08:00
parent d019565532
commit 513808f4c5
4 changed files with 70 additions and 113 deletions

View File

@ -15,7 +15,7 @@ const allPostsByDate = allPosts
.slice(0, MAX_POSTS) as CollectionEntry<"post">[];
// Notes
const MAX_NOTES = 5;
const MAX_NOTES = 6;
const allNotes = await getCollection("note");
const latestNotes = allNotes.sort(collectionDateSort).slice(0, MAX_NOTES);
---
@ -44,10 +44,10 @@ const latestNotes = allNotes.sort(collectionDateSort).slice(0, MAX_NOTES);
<h2 class="title text-accent mb-6 text-xl">
<a href="/notes/">Notes</a>
</h2>
<ul class="space-y-4" role="list">
<ul class="columns-1 gap-4 md:columns-2" role="list">
{latestNotes.map((note) => (
<li>
<Note note={note} as="h3" isPreview />
<Note note={note} as="h3" isPreview enableLineClamp />
</li>
))}
</ul>