@@ -95,29 +95,27 @@ export const Pagination = ({
95
95
. slice ( startingPosition , endingPosition )
96
96
97
97
// This end link may or may not be necessary based on overflow we calculated
98
- const endLink = (
99
- < >
100
- < div className = "more" >
101
- < OverflowMenuIcon className = "" />
102
- </ div >
103
- < PageLink
104
- pagePattern = { pagePattern }
105
- key = { `pagination-${ totalPages } ` }
106
- pageNumber = { totalPages }
107
- currentPage = { currentPage }
108
- />
109
- </ >
110
- )
98
+ const endLink = [
99
+ < div key = "pagination-overflow" className = "more" >
100
+ < OverflowMenuIcon className = "" />
101
+ </ div > ,
102
+ < PageLink
103
+ key = "pagination-end-link"
104
+ pagePattern = { pagePattern }
105
+ pageNumber = { totalPages }
106
+ currentPage = { currentPage }
107
+ />
108
+ ]
111
109
112
110
// Build our link array here (with possible overflow)
113
- const shownLinks = showOverflow ? [ ...links , endLink ] : links
111
+ const shownLinks = showOverflow ? [ ...links , ... endLink ] : links
114
112
115
113
// We want to know if we should be activating the forward/backward based on
116
114
// the position we are at in the sequence.
117
115
const disableBack = currentPage === 1
118
116
const disableForward = currentPage === totalPages
119
- const backLink = currentPage === 2 ? pagePattern : `${ pagePattern } ${ currentPage - 1 } `
120
- const forwardLink = disableForward ? '#' : `${ pagePattern } ${ currentPage + 1 } `
117
+ const backLink = currentPage === 2 ? pagePattern : `${ pagePattern } /page/ ${ currentPage - 1 } `
118
+ const forwardLink = disableForward ? '#' : `${ pagePattern } /page/ ${ currentPage + 1 } `
121
119
122
120
return showPagination ? (
123
121
< >
@@ -127,7 +125,7 @@ export const Pagination = ({
127
125
< ChevronLeftIcon className = "" />
128
126
</ button >
129
127
) : (
130
- < Link href = { backLink } >
128
+ < Link key = { 'pagination-backward' } href = { backLink } >
131
129
< button className = "pagination" >
132
130
< ChevronLeftIcon className = "" />
133
131
</ button >
@@ -139,7 +137,7 @@ export const Pagination = ({
139
137
< ChevronRightIcon className = "" />
140
138
</ button >
141
139
) : (
142
- < Link href = { forwardLink } >
140
+ < Link key = { 'pagination-forward' } href = { forwardLink } >
143
141
< button className = "pagination" >
144
142
< ChevronRightIcon className = "" />
145
143
</ button >
@@ -161,7 +159,7 @@ const PageLink = ({
161
159
currentPage : number
162
160
} ) => {
163
161
const buttonClass = pageNumber === currentPage ? 'active' : null
164
- const href = pageNumber === 1 ? pagePattern : `${ pagePattern } ${ pageNumber } `
162
+ const href = pageNumber === 1 ? pagePattern : `${ pagePattern } /page/ ${ pageNumber } `
165
163
return (
166
164
< Link href = { href } >
167
165
< button className = { cx ( 'pagination' , buttonClass ) } > { pageNumber } </ button >
0 commit comments