Skip to content

Commit

Permalink
fix: don't change value of nav button labels when new item has not lo…
Browse files Browse the repository at this point in the history
…aded yet
  • Loading branch information
paulpestov committed Dec 10, 2024
1 parent bd8947f commit 34d9e07
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/header/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@ const hasNext = computed<boolean>(() => {
const [nextPageLabel, previousPageLabel, nextDocumentLabel, previousDocumentLabel]: string[] = getNavButtonsLabels(configStore.config)
const nextButtonLabel = computed<string>(() => (
itemIndex.value === manifest.value.sequence.length - 1
? `${nextDocumentLabel}`
: `${nextPageLabel}`));
const nextButtonLabel = computed<string>((lastValue: string) => {
if (itemIndex.value === -1) return lastValue;
return itemIndex.value === manifest.value.sequence.length - 1
? `${nextDocumentLabel}`
: `${nextPageLabel}`;
});
const prevButtonLabel = computed<string>(() => (itemIndex.value === 0
? `${previousDocumentLabel}`
: `${previousPageLabel}`));
const prevButtonLabel = computed<string>((lastValue: string) => {
if (itemIndex.value === -1) return lastValue;
return itemIndex.value === 0 ? `${previousDocumentLabel}` : `${previousPageLabel}`;
});
function prev() {
const prevIndex = itemIndex.value - 1;
Expand Down

0 comments on commit 34d9e07

Please sign in to comment.