diff --git a/checkout/src/arquivos/js/checkout.js b/checkout/src/arquivos/js/checkout.js index 4559dcd..c8162e9 100644 --- a/checkout/src/arquivos/js/checkout.js +++ b/checkout/src/arquivos/js/checkout.js @@ -3,7 +3,6 @@ import { Container } from "m3-utils"; import "slick-carousel"; import Header from "./components/Header"; import Footer from "./components/Footer"; -import Content from "./components/content"; const m3Checkout = new Container({ appName: "m3-checkout", diff --git a/checkout/src/arquivos/js/components/Content.js b/checkout/src/arquivos/js/components/Content.js deleted file mode 100644 index 0dc6648..0000000 --- a/checkout/src/arquivos/js/components/Content.js +++ /dev/null @@ -1,43 +0,0 @@ -import { hasData } from "jquery"; -import { waitElement } from "m3-utils"; - -export default class Content { - constructor() { - this.init(); - } - - async selectors() { - this.titleMyCart = await waitElement("#cart-title"); - this.h2CartEmpty = await waitElement(".empty-cart-title", { - timeout: 5000, - interval: 1000, - }); - this.btnCartEmpty = await waitElement("#cart-choose-products", { - timeout: 5000, - interval: 1000, - }); - this.cartContent = await waitElement(".cart"); - } - - async init() { - await this.selectors(); - await this.insertHTML(); - await this.modificadedHTML(); - } - - async insertHTML() { - this.h2CartEmpty.innerHTML = `Seu carrinho está vazio`; - this.btnCartEmpty.innerHTML = `Continuar Comprando`; - } - - // async modificadedHTML() { - // let monitorDisplay = this.cartContent.style.display; - // window.sty - // if (this.cartContent.style.display === "none") { - // console.log("oioioi"); - // this.titleMyCart.classList.add("cartTitleInvisible"); - // } else if (this.titleMyCart.classList.contains("cartTitleInvisible")) { - // this.titleMyCart.classList.remove("cartTitleInvisible"); - // } - // } -} diff --git a/checkout/src/arquivos/js/components/Footer.js b/checkout/src/arquivos/js/components/Footer.js index 66e8a02..b0a1c2e 100644 --- a/checkout/src/arquivos/js/components/Footer.js +++ b/checkout/src/arquivos/js/components/Footer.js @@ -33,14 +33,19 @@ export default class Footer { if (window.location.href != "https://m3academy.myvtex.com/checkout/#/cart") { pratileira.classList.add("elementInvisible"); + } else { + pratileira.classList.remove("elementInvisible"); } window.addEventListener("hashchange", () => { - if (window.location.hash == "#/cart") { - this.pratileira.classList.remove("elementInvisible"); + if (window.location.hash == "#/cart" && target.style.display === "block") { + this.pratileira.classList.add("elementInvisible"); + titleCart.classList.add("elementInvisible"); this.api(); - } else { + } else if (window.location.hash != "#/cart") { pratileira.classList.add("elementInvisible"); + } else { + pratileira.classList.remove("elementInvisible"); } }); @@ -108,9 +113,11 @@ export default class Footer {