diff options
Diffstat (limited to 'src/components/Paginator.astro')
| -rw-r--r-- | src/components/Paginator.astro | 29 |
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> + ) +} |
