Fix changelog navigation directions (#411)
This commit is contained in:
committed by
GitHub
parent
56fa498b9a
commit
1583a743ce
@@ -35,17 +35,17 @@ async function changelogEntryLoader(slug: string) {
|
|||||||
|
|
||||||
// Find previous and next entries in the timeline
|
// Find previous and next entries in the timeline
|
||||||
const currentIndex = allEntries.items.findIndex((item) => item.slug === slug);
|
const currentIndex = allEntries.items.findIndex((item) => item.slug === slug);
|
||||||
const previousEntry =
|
const newerEntry =
|
||||||
currentIndex > 0 ? allEntries.items[currentIndex - 1] : null;
|
currentIndex > 0 ? allEntries.items[currentIndex - 1] : null;
|
||||||
const nextEntry =
|
const olderEntry =
|
||||||
currentIndex < allEntries.items.length - 1
|
currentIndex < allEntries.items.length - 1
|
||||||
? allEntries.items[currentIndex + 1]
|
? allEntries.items[currentIndex + 1]
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
entry,
|
entry,
|
||||||
previousEntry,
|
previousEntry: olderEntry,
|
||||||
nextEntry,
|
nextEntry: newerEntry,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user