summaryrefslogtreecommitdiff
path: root/src/components/Paginator.astro
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-07-03 10:56:21 +0300
committerDawid Rycerz <dawid@rycerz.xyz>2025-07-03 10:56:21 +0300
commit456cf011b36de91c9936994b1fa45703adcd309b (patch)
tree8e60daf998f731ac50d100fa490eaecae1168042 /src/components/Paginator.astro
Initial fork of chrismwilliams/astro-theme-cactus theme
Diffstat (limited to 'src/components/Paginator.astro')
-rw-r--r--src/components/Paginator.astro29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/Paginator.astro b/src/components/Paginator.astro
new file mode 100644
index 0000000..0678487
--- /dev/null
+++ b/src/components/Paginator.astro
@@ -0,0 +1,29 @@
+---
+import type { PaginationLink } from "@/types";
+
+interface Props {
+ nextUrl?: PaginationLink;
+ prevUrl?: PaginationLink;
+}
+
+const { nextUrl, prevUrl } = Astro.props;
+---
+
+{
+ (prevUrl || nextUrl) && (
+ <nav class="mt-8 flex items-center gap-x-4">
+ {prevUrl && (
+ <a class="hover:text-accent me-auto py-2" data-astro-prefetch href={prevUrl.url}>
+ {prevUrl.srLabel && <span class="sr-only">{prevUrl.srLabel}</span>}
+ {prevUrl.text ? prevUrl.text : "Previous"}
+ </a>
+ )}
+ {nextUrl && (
+ <a class="hover:text-accent ms-auto py-2" data-astro-prefetch href={nextUrl.url}>
+ {nextUrl.srLabel && <span class="sr-only">{nextUrl.srLabel}</span>}
+ {nextUrl.text ? nextUrl.text : "Next"}
+ </a>
+ )}
+ </nav>
+ )
+}