1
0
Fork 0

fix: Off-by-one error in PrevNext

This commit is contained in:
joostdecock 2023-07-14 15:08:50 +02:00
parent 0077870f16
commit 232dddb019

View file

@ -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