From 0fc5a27e8119741e055ce939f79daef585bf8f34 Mon Sep 17 00:00:00 2001 From: isabel Date: Thu, 13 Nov 2025 13:06:26 +0000 Subject: [PATCH] feat: add home & lyrics/queue button --- src/components/MusicPlayer.astro | 56 +++++++++++++++++++++++++------- src/components/Song.astro | 2 +- src/pages/blog/[...slug].astro | 30 +++++++++++++++-- 3 files changed, 72 insertions(+), 16 deletions(-) diff --git a/src/components/MusicPlayer.astro b/src/components/MusicPlayer.astro index 29cbb90..ef12ec9 100644 --- a/src/components/MusicPlayer.astro +++ b/src/components/MusicPlayer.astro @@ -1,10 +1,13 @@ --- +import { type CollectionEntry } from "astro:content"; import { Icon } from "astro-icon/components"; import { Image } from "astro:assets"; +import Song from "@components/Song.astro"; import me from "@assets/me.webp"; interface Props { isPlaying?: boolean; + posts?: CollectionEntry<"blog">[]; nowPlaying: string; playPercent: number; playPositon: string; @@ -14,6 +17,7 @@ interface Props { const { isPlaying = false, + posts, nowPlaying, playPercent, playPositon, @@ -23,15 +27,37 @@ const { ---
- isabel roses +
+ isabel roses + + { + posts && ( +
+
    + {posts.entries().map(([i, post]) => ( + + ))} +
+
+ ) + } +
@@ -55,8 +81,10 @@ const {
-
- +
+
- +
diff --git a/src/components/Song.astro b/src/components/Song.astro index a86939e..234b680 100644 --- a/src/components/Song.astro +++ b/src/components/Song.astro @@ -25,7 +25,7 @@ const { title, slug, index, time, id } = Astro.props as Props; )} ) : ( -
+
{index} diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 37d1fe3..7424dca 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -13,18 +13,20 @@ export async function getStaticPaths() { params: { slug: post.id }, props: { post, - nextSlug: posts[posts.indexOf(post) + 1]?.id || null, + posts, }, })); } interface Props { post: CollectionEntry<"blog">; - nextSlug: string | null; + posts: CollectionEntry<"blog">[]; } -const { post, nextSlug } = Astro.props; +const { post, posts } = Astro.props; + const { Content } = await render(post); +const nextSlug = posts[posts.indexOf(post) + 1]?.id || null; ---
@@ -49,6 +52,27 @@ const { Content } = await render(post);