From 8b94b1423ffea638fe5c557fce58b7f87d7ab5f0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 29 Jun 2025 14:44:45 +0900 Subject: feat(blog/style): change page navigation style --- services/blog/nuldoc-src/components/Pagination.tsx | 58 +++++++++++++++++++--- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'services/blog/nuldoc-src/components') diff --git a/services/blog/nuldoc-src/components/Pagination.tsx b/services/blog/nuldoc-src/components/Pagination.tsx index 5527c924..ab13e361 100644 --- a/services/blog/nuldoc-src/components/Pagination.tsx +++ b/services/blog/nuldoc-src/components/Pagination.tsx @@ -11,31 +11,69 @@ export default function Pagination( return
; } + const firstPage = 1; + const lastPage = totalPages; const prevPage = currentPage > 1 ? currentPage - 1 : null; const nextPage = currentPage < totalPages ? currentPage + 1 : null; - const prevHref = prevPage === 1 ? basePath : `${basePath}${prevPage}/`; - const nextHref = `${basePath}${nextPage}/`; + const firstHref = pageUrlAt(basePath, firstPage); + const lastHref = pageUrlAt(basePath, lastPage); + const prevHref = prevPage ? pageUrlAt(basePath, prevPage) : null; + const nextHref = nextPage ? pageUrlAt(basePath, nextPage) : null; return ( ); } + +function pageUrlAt(basePath: string, page: number): string { + return page === 1 ? basePath : `${basePath}${page}/`; +} -- cgit v1.2.3-70-g09d2