src/components/common/Paginator.astro 735 B raw
1
---
2
import type { PaginationLink } from "@/data/shared";
3
4
interface Props {
5
	prevUrl?: PaginationLink;
6
	nextUrl?: PaginationLink;
7
}
8
9
const { prevUrl, nextUrl } = Astro.props;
10
---
11
12
{
13
	(prevUrl || nextUrl) && (
14
		<nav class="flex items-center gap-x-4">
15
			{prevUrl && (
16
				<a class="mr-auto py-2 sm:hover:text-accent" href={prevUrl.url} rel="prefetch">
17
					{prevUrl.srLabel && <span class="sr-only">{prevUrl.srLabel}</span>}
18
					{prevUrl.text ? prevUrl.text : "Previous"}
19
				</a>
20
			)}
21
			{nextUrl && (
22
				<a class="ml-auto py-2 sm:hover:text-accent" href={nextUrl.url} rel="prefetch">
23
					{nextUrl.srLabel && <span class="sr-only">{nextUrl.srLabel}</span>}
24
					{nextUrl.text ? nextUrl.text : "Next"}
25
				</a>
26
			)}
27
		</nav>
28
	)
29
}