Skip to content

Commit

Permalink
fix: The previous and next pages carry baseurl
Browse files Browse the repository at this point in the history
  • Loading branch information
wsafight committed Jan 19, 2025
1 parent 8287e42 commit 31a864f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/control/Pagination.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ interface Props {
const { page, style } = Astro.props
const baseUrl = import.meta.env.BASE_URL
const prevPage = page.url.prev?.replace(baseUrl, '')
const nextPage = page.url.next?.replace(baseUrl, '')
const HIDDEN = -1
const className = Astro.props.class
Expand Down Expand Up @@ -51,9 +56,9 @@ const getPageUrl = (p: number) => {
---

<div class:list={[className, "flex flex-row gap-3 justify-center"]} style={style}>
<a href={url(page.url.prev || "")} aria-label={page.url.prev ? "Previous Page" : null}
<a href={url(prevPage || "")} aria-label={prevPage ? "Previous Page" : null}
class:list={["btn-card overflow-hidden rounded-lg text-[var(--primary)] w-11 h-11",
{"disabled": page.url.prev == undefined}
{"disabled": prevPage == undefined}
]}
>
<Icon name="material-symbols:chevron-left-rounded" class="text-[1.75rem]"></Icon>
Expand All @@ -73,9 +78,9 @@ const getPageUrl = (p: number) => {
>{p}</a>
})}
</div>
<a href={url(page.url.next || "")} aria-label={page.url.next ? "Next Page" : null}
<a href={url(nextPage || "")} aria-label={nextPage ? "Next Page" : null}
class:list={["btn-card overflow-hidden rounded-lg text-[var(--primary)] w-11 h-11",
{"disabled": page.url.next == undefined}
{"disabled": nextPage == undefined}
]}
>
<Icon name="material-symbols:chevron-right-rounded" class="text-[1.75rem]"></Icon>
Expand Down

0 comments on commit 31a864f

Please sign in to comment.