Skip to content

Commit

Permalink
FIX: added check stepIndex = 0 to updateDialog for disabled state on …
Browse files Browse the repository at this point in the history
…previous button
  • Loading branch information
sjmc11 committed Mar 22, 2023
1 parent 09cd70a commit f748481
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/tour.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sjmc11/tourguidejs",
"version": "0.0.8",
"version": "0.0.9",
"description": "A customizable tour guide library for front-end applications.",
"homepage": "https://tourguidejs.com",
"main": "dist/tour.js",
Expand All @@ -12,7 +12,7 @@
"tour"
],
"author": "JC",
"license": "GNU",
"license": "MIT",
"dependencies": {
"@floating-ui/dom": "^1.0.3",
"sass": "^1.55.0"
Expand Down
12 changes: 12 additions & 0 deletions src/core/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ function updateDialogHtml(tgInstance : TourGuideClient){
const tgDots = document.getElementById('tg-dialog-dots')
if(tgDots && tgInstance.options.showStepDots && computeDots(tgInstance)) tgDots.innerHTML = computeDots(tgInstance)

// Back button
const backBtn = document.getElementById('tg-dialog-prev-btn')
if(backBtn) {
if (tgInstance.activeStep === 0) {
backBtn.classList.add('disabled')
backBtn.setAttribute("disabled", 'true');
} else {
backBtn.classList.remove('disabled')
backBtn.removeAttribute("disabled");
}
}

// Next/Finish button
const nextBtn = document.getElementById('tg-dialog-next-btn')
if(nextBtn) nextBtn.innerHTML = ((tgInstance.activeStep + 1) >= tgInstance.tourSteps.length ? tgInstance.options.finishLabel : tgInstance.options.nextLabel) as string
Expand Down

0 comments on commit f748481

Please sign in to comment.