Skip to content

Commit

Permalink
MWPW-142972 | Integrating review comments (#267)
Browse files Browse the repository at this point in the history
Integrating review comments for delay authoring of Start over button. 0-99 will be considered as sec and 99+ will be ms
  • Loading branch information
aishwaryamathuria authored Apr 17, 2024
1 parent 0e52426 commit 0eaa0c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async function handleLayerDisplay(stepInfo) {
await handleImageTransition(stepInfo);
await loadAllImgs(currLayer.querySelectorAll('img[src*="media_"]'));
await decorateDefaultLinkAnalytics(currLayer);
if (prevStepIndex) stepInfo.target.classList.remove(`step-${stepInfo.stepList[prevStepIndex]}`);
if (prevStepIndex !== stepInfo.stepIndex) stepInfo.target.classList.remove(`step-${stepInfo.stepList[prevStepIndex]}`);
if (clsLayer) clsLayer.remove();
stepInfo.target.classList.add(`step-${stepInfo.stepName}`);
currLayer.classList.add('show-layer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function btnLoadDelay(layer, button, delay, once = true) {
entries.forEach(async (entry) => {
if (entry.isIntersecting) {
if (once) observer.unobserve(entry.target);
setTimeout(() => { button.style.display = 'flex'; }, parseInt(delay, 10));
setTimeout(() => { button.style.display = 'flex'; }, delay);
}
});
});
Expand Down Expand Up @@ -37,8 +37,11 @@ export default async function stepInit(data) {
data.el.dispatchEvent(new CustomEvent(data.nextStepEvent));
});
}
if (delay) btnLoadDelay(layer, startOverCTA, delay);
else startOverCTA.style.display = 'flex';
if (delay) {
const dInt = parseInt(delay, 10);
const normDelay = dInt > 99 ? dInt : (dInt * 1000);
btnLoadDelay(layer, startOverCTA, normDelay);
} else startOverCTA.style.display = 'flex';
layer.append(startOverCTA);
return layer;
}

0 comments on commit 0eaa0c6

Please sign in to comment.