fix: Off-by-one error in PrevNext
This commit is contained in:
parent
0077870f16
commit
232dddb019
1 changed files with 1 additions and 1 deletions
|
@ -39,7 +39,7 @@ export const PrevNext = ({ slug }) => {
|
||||||
const index = slugLut.indexOf(slug)
|
const index = slugLut.indexOf(slug)
|
||||||
|
|
||||||
// Add 1 for the next page, unless it's the last page
|
// Add 1 for the next page, unless it's the last page
|
||||||
const iNext = index === slugLut.length ? 0 : index + 1
|
const iNext = index === slugLut.length - 1 ? 0 : index + 1
|
||||||
|
|
||||||
// Subtract 1 for the previous page, unless it's the first page
|
// Subtract 1 for the previous page, unless it's the first page
|
||||||
const iPrev = index === 0 ? slugLut.length - 1 : index - 1
|
const iPrev = index === 0 ? slugLut.length - 1 : index - 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue