diff --git a/checkout/src/arquivos/js/components/Footer.js b/checkout/src/arquivos/js/components/Footer.js index 0276a4a..f68e8e8 100644 --- a/checkout/src/arquivos/js/components/Footer.js +++ b/checkout/src/arquivos/js/components/Footer.js @@ -3,8 +3,7 @@ import { waitElement } from "m3-utils"; export default class Footer { constructor() { this.init(); - this.footerHTML(); - this.addCarrossel(); + } @@ -62,7 +61,6 @@ export default class Footer { ` footerPrat.children[1].appendChild(li) - console.log(footerPrat.children[1]) }) }) diff --git a/checkout/src/arquivos/js/components/Header.js b/checkout/src/arquivos/js/components/Header.js index 6fd8a5c..477ffa5 100644 --- a/checkout/src/arquivos/js/components/Header.js +++ b/checkout/src/arquivos/js/components/Header.js @@ -4,12 +4,12 @@ import { waitElement } from "m3-utils"; export default class Header { constructor() { this.init(); - this.progressBarHTML(); } async init() { await this.selectors(); this.progressBarHTML(); + this.stopPointBar(); } async selectors() { @@ -26,7 +26,7 @@ export default class Header {

Pagamento

@@ -37,4 +37,124 @@ export default class Header { } }; + async stopPointBar() { + if (this.progressBar && window.innerWidth > 1024) { + const progressBarLista = document.querySelectorAll(".progressbar-ul") + progressBarLista.forEach((progressBarLista) => { + if (window.location.href === "https://m3academy.myvtex.com/checkout/#/cart") { + if (progressBarLista.children[0]) { + progressBarLista.children[0].classList.add("active") + + } + + if (progressBarLista.children[1]) { + if (progressBarLista.children[1].classList.contains("active")) { + progressBarLista.children[1].classList.remove("active") + } + } + if (progressBarLista.children[2]) { + if (progressBarLista.children[2].classList.contains("active")) { + progressBarLista.children[2].classList.remove("active") + } + } + } + else if (window.location.href === "https://m3academy.myvtex.com/checkout/#/email" || + window.location.href === "https://m3academy.myvtex.com/checkout/#/profile" || + window.location.href === "https://m3academy.myvtex.com/checkout/#/shipping") { + + if (progressBarLista.children[0]) { + if (progressBarLista.children[0].classList.contains("active")) { + progressBarLista.children[0].classList.remove("active") + } + } + + if (progressBarLista.children[1]) { + progressBarLista.children[1].classList.add("active") + } + + if (progressBarLista.children[2]) { + if (progressBarLista.children[2].classList.contains("active")) { + progressBarLista.children[2].classList.remove("active") + } + } + } + else if (window.location.href === "https://m3academy.myvtex.com/checkout/#/payment") { + + if (progressBarLista.children[0]) { + if (progressBarLista.children[0].classList.contains("active")) { + progressBarLista.children[0].classList.remove("active") + } + } + + if (progressBarLista.children[1]) { + if (progressBarLista.children[1].classList.contains("active")) { + progressBarLista.children[1].classList.remove("active") + } + } + + if (progressBarLista.children[2]) { + progressBarLista.children[2].classList.add("active") + } + } + + window.addEventListener("hashchange", () => { + if (window.location.hash == "#/cart") { + if (progressBarLista.children[0]) { + progressBarLista.children[0].classList.add("active") + } + + if (progressBarLista.children[1]) { + if (progressBarLista.children[1].classList.contains("active")) { + progressBarLista.children[1].classList.remove("active") + } + } + + if (progressBarLista.children[2]) { + if (progressBarLista.children[2].classList.contains("active")) { + progressBarLista.children[2].classList.remove("active") + } + } + } + + else if (window.location.hash == "#/email" || + window.location.hash == "#/profile" || + window.location.hash == "#/shipping") { + if (progressBarLista.children[0]) { + if (progressBarLista.children[0].classList.contains("active")) { + progressBarLista.children[0].classList.remove("active") + } + } + + if (progressBarLista.children[1]) { + progressBarLista.children[1].classList.add("active") + } + + if (progressBarLista.children[2]) { + if (progressBarLista.children[2].classList.contains("active")) { + progressBarLista.children[2].classList.remove("active") + } + } + } + + else if (window.location.hash == "#/payment") { + if (progressBarLista.children[0]) { + if (progressBarLista.children[0].classList.contains("active")) { + progressBarLista.children[0].classList.remove("active") + } + } + + if (progressBarLista.children[1]) { + if (progressBarLista.children[1].classList.contains("active")) { + progressBarLista.children[1].classList.remove("active") + } + } + + if (progressBarLista.children[2]) { + progressBarLista.children[2].classList.add("active") + } + } + }) + }) + } + } }