From 60eeddda15405ec2b8af502416d87f4fb5748ec6 Mon Sep 17 00:00:00 2001 From: Frontendland Date: Fri, 20 Sep 2024 11:58:31 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Allow=20dot=20paginations=20to=20be?= =?UTF-8?q?=20created=20without=20pages=20prop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Pagination/Pagination.astro | 9 ++++++++- src/components/Pagination/Pagination.svelte | 13 ++++++++++--- src/components/Pagination/Pagination.tsx | 17 +++++++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/components/Pagination/Pagination.astro b/src/components/Pagination/Pagination.astro index c303b71..e76dafb 100644 --- a/src/components/Pagination/Pagination.astro +++ b/src/components/Pagination/Pagination.astro @@ -41,6 +41,13 @@ const calculatedCurrentPage = currentPage const calculatedTotalPages = totalPages || pages?.length || 0 + +const generatedPages = pages?.length + ? pages + : Array(totalPages || 0).fill(0).map((_, index) => ({ + ...(index === 0 && { active: true }), + label: index + 1 + })) ---