From 5217bcb24ceac2e7d441586edc56feba60b482a9 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 13 Sep 2024 00:26:08 +0000 Subject: Refactor Pagination component to update page size in getStaticPaths --- src/components/Pagination.astro | 27 +++++++++++++++++++-------- src/components/Pagination/Next.astro | 18 ------------------ src/components/Pagination/Prev.astro | 18 ------------------ src/pages/[...page].astro | 2 +- 4 files changed, 20 insertions(+), 45 deletions(-) delete mode 100644 src/components/Pagination/Next.astro delete mode 100644 src/components/Pagination/Prev.astro (limited to 'src') diff --git a/src/components/Pagination.astro b/src/components/Pagination.astro index 835ea2d..0d656df 100644 --- a/src/components/Pagination.astro +++ b/src/components/Pagination.astro @@ -1,7 +1,4 @@ --- -import Next from "./Pagination/Next.astro"; -import Prev from "./Pagination/Prev.astro"; - type Props = { readonly nextUrl?: string; readonly prevUrl?: string; @@ -12,13 +9,27 @@ const { nextUrl, prevUrl } = Astro.props;
- {prevUrl && } - {nextUrl && } + { + prevUrl && ( + + < Prev + + ) + } + { + nextUrl && ( + + Next > + + ) + }
diff --git a/src/components/Pagination/Next.astro b/src/components/Pagination/Next.astro deleted file mode 100644 index 1a95710..0000000 --- a/src/components/Pagination/Next.astro +++ /dev/null @@ -1,18 +0,0 @@ ---- -type Props = { - readonly url: string; -}; - -const { url } = Astro.props; ---- - - - - - Next > - diff --git a/src/components/Pagination/Prev.astro b/src/components/Pagination/Prev.astro deleted file mode 100644 index 2454876..0000000 --- a/src/components/Pagination/Prev.astro +++ /dev/null @@ -1,18 +0,0 @@ ---- -type Props = { - readonly url: string; -}; - -const { url } = Astro.props; ---- - - - - - < Prev - diff --git a/src/pages/[...page].astro b/src/pages/[...page].astro index 2a6f5cc..42f84b3 100644 --- a/src/pages/[...page].astro +++ b/src/pages/[...page].astro @@ -12,7 +12,7 @@ export const getStaticPaths = (async ({ paginate }) => { posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); return paginate(posts, { - pageSize: 5, + pageSize: 10, }); }) satisfies GetStaticPaths; -- cgit v1.2.3