diff --git a/checkout/src/arquivos/js/components/Footer.js b/checkout/src/arquivos/js/components/Footer.js index 635341d..4601f8a 100644 --- a/checkout/src/arquivos/js/components/Footer.js +++ b/checkout/src/arquivos/js/components/Footer.js @@ -7,50 +7,70 @@ export default class Footer { async init() { this.list = await this.fetchApiData(); + await this.selectors(); this.cartTitle = await waitElement("#cart-title"); + console.log(this.cartTitle); + await this.cartUpdate(); this.emptyTitle = await waitElement(".empty-cart-title"); this.emptyButton = await waitElement(".link-choose-products"); + this.paymentsMethods = await waitElement(".footerCheckout__payments"); + this.certification = await waitElement(".footerCheckout__vtexpci"); + this.developedBy = await waitElement(".footerCheckout__developedBy"); this.emptyCartTitle(); this.emptyCartButton(); - await this.selectors(); + this.addPaymentsMethodsIcons(); + this.addCertificationIcon(); + this.addDevelopedByIcons(); this.events(); - this.cartUpdate(); this.items = await waitElement(".footerCheckout__prateleira-container"); console.log(this.items, "console de items"); - this.renderItems(); + await this.renderItems(); await this.addCarrossel(); } async selectors() { //Para verificar se o carrinho está vazio e remover a prateleira de produtos: // vocês devem olhar a doc fornecida no Desafio para aprender a usar o waitElement - this.checkoutVazio = await waitElement(".empty-cart-content"); - this.prateleira = await waitElement(".footerCheckout__prateleira"); + this.checkoutVazio = await waitElement(".empty-cart-content", { + timeout: 5000, + interval: 1, + }); + this.prateleira = await waitElement(".footerCheckout__prateleira", { + timeout: 5000, + interval: 1, + }); } events() { window.addEventListener("hashchange", this.outPrateleira.bind(this)); } - cartUpdate() { + async cartUpdate() { console.log("cartUpdate"); //Função que fará a verificação se o carrinho está vazio para remover a prateleira de produtos: // vocês devem olhar a doc fornecida no Desafio para aprender a usar a MutationObserver // sempre que o carrinho estiver vazio o elemento chcekoutVazio fica display: none e isso pode ser usado como atributo para a MutationObserver let target = this.checkoutVazio; + console.log("target"); let config = { childList: true, attributes: true }; - let observer = new MutationObserver((mutations) => { + console.log("config"); + let observer = await new MutationObserver((mutations) => { + console.log("observer"); mutations.map((mutation) => { const cartStatus = mutation.target.attributes.style.nodeValue; console.log(cartStatus); if (cartStatus === "display: none;") { - this.cartTitle.classList.remove("inactive"); this.renderPrateleira(); + console.log("Adiciona Prateleira"); + this.cartTitle.classList.remove("inactive"); + console.log("Adiciona Título"); } else if (cartStatus === "display: block;") { - this.cartTitle.classList.add("inactive"); this.removePrateleira(); + console.log("Remove Prateleira"); + this.cartTitle.classList.add("inactive"); + console.log("Remove Título"); } }); }); @@ -75,7 +95,7 @@ export default class Footer { }); } - renderPrateleira() { + async renderPrateleira() { let itemsStructure = `

Você também pode gostar:

@@ -89,7 +109,7 @@ export default class Footer { this.prateleira.innerHTML = itemsStructure; } - renderItems() { + async renderItems() { let itemsCards = ``; this.list.forEach((item) => { const sku = item.skus.map((resp) => `
  • ${resp}
  • `); @@ -98,7 +118,7 @@ export default class Footer {
    Imagem Ponto Turístico
    @@ -139,6 +159,61 @@ export default class Footer { this.emptyButton.innerHTML = `Continuar Comprando`; } + addPaymentsMethodsIcons() { + this.paymentsMethods.innerHTML = ` +
  • + Ícone método pagamento +
  • +
  • + Ícone método pagamento +
  • +
  • + Ícone método pagamento +
  • +
  • + Ícone método pagamento +
  • +
  • + Ícone método pagamento +
  • +
  • + Ícone método pagamento +
  • +
  • + Ícone método pagamento +
  • + `; + } + + addCertificationIcon() { + this.certification.innerHTML = ` +
  • + Ícone Certificado +
  • + `; + } + + addDevelopedByIcons() { + this.developedBy.innerHTML = ` +
  • + + Powered By + + Logo da Vtex + + +
  • +
  • + + Developed By + + Logo da M3 + + +
  • + `; + } + async addCarrossel() { const elemento = await waitElement(".footerCheckout__prateleira-container"); $(elemento).slick({ diff --git a/checkout/src/arquivos/js/components/Header.js b/checkout/src/arquivos/js/components/Header.js index a2ce14d..53b9881 100644 --- a/checkout/src/arquivos/js/components/Header.js +++ b/checkout/src/arquivos/js/components/Header.js @@ -8,9 +8,9 @@ export default class Header { async init() { await this.selectors(); + // this.events(); this.progressBarHTML(); await this.progressBarProgress(); - // console.log(this.progressBar); } async selectors() { @@ -25,6 +25,10 @@ export default class Header { }); } + events() { + window.addEventListener("resize", this.displayWindowSize.bind(this)); + } + progressBarHTML() { if (this.progressBar && window.innerWidth > 1024) { this.progressBar.innerHTML = ` @@ -35,11 +39,19 @@ export default class Header { `; } - if (this.progressBar && window.innerHTML <= 1024) { - this.progressBar.innerHTML = `${" "}`; - } } + // displayWindowSize() { + // let width = window.outerWidth; + + // if (width > 1024) { + // this.progressBar.classList.remove("inactive"); + // } + // if (width <= 1024) { + // this.progressBar.classList.add("inactive"); + // } + // } + async progressBarProgress() { if (this.progressBar && window.innerWidth > 1024) { const progressBarList = document.querySelectorAll("#progressBar ul li"); diff --git a/checkout/src/arquivos/sass/partials/_footer.scss b/checkout/src/arquivos/sass/partials/_footer.scss index b17422b..e3ecb5f 100644 --- a/checkout/src/arquivos/sass/partials/_footer.scss +++ b/checkout/src/arquivos/sass/partials/_footer.scss @@ -133,9 +133,6 @@ } &__wrapper { - align-items: center; - display: flex; - justify-content: space-between; margin-top: 56px !important; border-top: 1px solid $color-black; width: 100% !important; @@ -144,17 +141,23 @@ display: flex; justify-content: space-between; align-items: center; + width: 95%; height: 65px; + + &::before, + &::after { + display: none; + } } } &__address { color: $color-gray2; - font-family: $font-family; + font-family: "Open Sans"; font-style: normal; - font-weight: normal; + font-weight: 400; font-size: 10px; - line-height: 12px; + line-height: 14px; text-transform: capitalize; max-width: 40%; @@ -167,8 +170,22 @@ &__stamps { align-items: center; display: flex; - justify-self: center; + justify-content: space-between; list-style: none; + width: 33.224%; + max-width: 404px; + + span { + display: flex; + justify-content: space-between; + height: 20px; + gap: 13px; + + img { + display: block; + height: 100%; + } + } @include mq(md, max) { align-self: center; @@ -184,6 +201,10 @@ } } + &__vtexpci { + height: 33px !important; + } + &__developedBy { align-items: center; display: flex; @@ -206,7 +227,15 @@ text-decoration: none; span { - margin-right: 8px; + display: flex; + justify-content: center; + align-items: center; + } + + img { + display: block; + height: 16px; + margin-left: 8px; } } } diff --git a/checkout/src/arquivos/sass/partials/_header.scss b/checkout/src/arquivos/sass/partials/_header.scss index e05e1e4..45ee213 100644 --- a/checkout/src/arquivos/sass/partials/_header.scss +++ b/checkout/src/arquivos/sass/partials/_header.scss @@ -90,6 +90,12 @@ border-top: 1px solid $color-black; } } + + @media (max-width: 1024px) { + .progress-bar { + display: none; + } + } } &__wrapper { align-items: center; diff --git a/checkout/src/arquivos/sass/utils/_variaveis.scss b/checkout/src/arquivos/sass/utils/_variaveis.scss index 82d7f8b..3ce2a5c 100644 --- a/checkout/src/arquivos/sass/utils/_variaveis.scss +++ b/checkout/src/arquivos/sass/utils/_variaveis.scss @@ -10,7 +10,7 @@ $color-black: #000000; $color-white: #ffffff; $color-gray: #6c6c6c; -$color-gray2: #7d7d7d; +$color-gray2: #292929; $color-gray3: #f0f0f0; $color-gray4: #8d8d8d; $color-gray5: #e5e5e5;