Skip to content

Commit 6618884

Browse files
committed
fix: pagination pre next error
1 parent 445ec08 commit 6618884

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/components/control/Pagination.astro

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ interface Props {
99
}
1010
1111
const { page, style } = Astro.props
12+
const baseUrl = import.meta.env.BASE_URL
13+
14+
const prevUrl = page.url.prev?.replace(baseUrl, '')
15+
const nextUrl = page.url.next?.replace(baseUrl, '')
16+
1217
1318
const HIDDEN = -1
1419
@@ -50,10 +55,11 @@ const getPageUrl = (p: number) => {
5055
}
5156
---
5257

58+
5359
<div class:list={[className, "flex flex-row gap-3 justify-center"]} style={style}>
54-
<a href={url(page.url.prev || "")} aria-label={page.url.prev ? "Previous Page" : null}
60+
<a href={url(prevUrl || "")} aria-label={prevUrl ? "Previous Page" : null}
5561
class:list={["btn-card overflow-hidden rounded-lg text-[var(--primary)] w-11 h-11",
56-
{"disabled": page.url.prev == undefined}
62+
{"disabled": prevUrl == undefined}
5763
]}
5864
>
5965
<Icon name="material-symbols:chevron-left-rounded" class="text-[1.75rem]"></Icon>
@@ -73,9 +79,9 @@ const getPageUrl = (p: number) => {
7379
>{p}</a>
7480
})}
7581
</div>
76-
<a href={url(page.url.next || "")} aria-label={page.url.next ? "Next Page" : null}
82+
<a href={url(nextUrl || "")} aria-label={nextUrl ? "Next Page" : null}
7783
class:list={["btn-card overflow-hidden rounded-lg text-[var(--primary)] w-11 h-11",
78-
{"disabled": page.url.next == undefined}
84+
{"disabled": nextUrl == undefined}
7985
]}
8086
>
8187
<Icon name="material-symbols:chevron-right-rounded" class="text-[1.75rem]"></Icon>

0 commit comments

Comments
 (0)