From 39c058be6f5d7ef16e2005a61eee332872b4289c Mon Sep 17 00:00:00 2001 From: jorgev259 Date: Tue, 22 Apr 2025 22:26:52 -0600 Subject: [PATCH] Serach pagination improvements --- src/components/search/AlbumSearch.astro | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/search/AlbumSearch.astro b/src/components/search/AlbumSearch.astro index faebc3a..291533a 100644 --- a/src/components/search/AlbumSearch.astro +++ b/src/components/search/AlbumSearch.astro @@ -40,18 +40,20 @@ const [count, search] = await Promise.all([ ]) --- -
+
Albums ({count}) { count > take ? ( - / Showing {page === 1 ? `first ${take}` : `${(page - 1) * take}-${page * take}`} results + / Showing {page === 1 ? `first ${take}` : `${(page - 1) * take}-${Math.min(page * take, count)}`} results ) : null }
-
- {Array.from({ length: Math.ceil(count / take) }, (_, i) => ( - {i + 1} - ))} +
+ { + Array.from({ length: Math.ceil(count / take) }, (_, i) => + page === i + 1 ? {i + 1} : {i + 1} + ) + }