feature/footer #1

Merged
RamonDiasFerreira merged 5 commits from feature/footer into develop 2022-12-18 23:54:59 +00:00
2 changed files with 25 additions and 14 deletions
Showing only changes of commit 62be124c6d - Show all commits

View File

@ -8,15 +8,14 @@ export default class Footer {
async init() { async init() {
this.list = await this.requestApi(); this.list = await this.requestApi();
await this.selectors(); await this.selectors();
this.creditCardIconsHTML();
this.developedByIconsHTML();
// this.onUpdate();
this.createShelf(); this.createShelf();
this.shelfList = await waitElement(".footerCheckout__shelfList"); this.shelfList = await waitElement(".footerCheckout__shelfList");
this.shelfItens(); this.shelfItens();
await this.shelfUpdate();
this.addCarrossel(); this.addCarrossel();
this.creditCardIconsHTML();
this.developedByIconsHTML();
} }
async selectors() { async selectors() {
@ -78,21 +77,30 @@ export default class Footer {
}); });
} }
events() {
window.addEventListener("hashchange", () =>{})
}
onUpdate() { async shelfUpdate() {
//Função qeu 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; let target = this.checkoutVazio;
let config = { childList: true, attributes: true }; let config = { childList: true, attributes: true };
let observer = new MutationObserver((mutations) => { let observer = new MutationObserver((mutations) => {
mutations.forEach(function (mutation) { console.log("observer");
console.log(mutation.type); mutations.map((mutation) => {
}); const status = mutation.target.attributes.style.nodeValue;
}); console.log(status);
if(status === "display: none") {
this.renderShelf();
this.shelfList.classList.remove("inactive");
} else if (status === "display: block") {
this.removeShelf();
this.shelfList.classList.add("inactive");
}
})
})
observer.observe(target, config); observer.observe(target, config);
} }
async addCarrossel() { async addCarrossel() {
const elemento = await waitElement(".footerCheckout__shelfList"); const elemento = await waitElement(".footerCheckout__shelfList");
$(elemento).slick({ $(elemento).slick({

View File

@ -8,6 +8,9 @@
padding: 0 16px; padding: 0 16px;
} }
} }
&-message {
display: none;
}
&-title { &-title {
font-size: 20px; font-size: 20px;