feat(footer): corrige logica e css em scss para a prateleira

This commit is contained in:
carloswinter 2022-12-18 23:01:09 -03:00
parent 28ef57bec3
commit 956c39fc9d
4 changed files with 22 additions and 22 deletions

View File

@ -31,7 +31,7 @@ export default class Footer {
} }
this.cartTitle.style.display = "block"; this.cartTitle.style.display = "block";
} }
console.log("HASHCHANGE FOOTER");
if (window.location.hash == "#/cart" && this.checkoutVazio.style.display == "none") { if (window.location.hash == "#/cart" && this.checkoutVazio.style.display == "none") {
this.list.style.display = "flex"; this.list.style.display = "flex";
} }
@ -56,7 +56,7 @@ export default class Footer {
// timeout: 5000, // timeout: 5000,
// interval: 1000, // interval: 1000,
// }); // });
this.allList = await waitElement(".footerCheckout"); this.fullList = await waitElement(".footerCheckout");
this.checkoutVazio = await waitElement(".empty-cart-content"); this.checkoutVazio = await waitElement(".empty-cart-content");
this.payments = await waitElement(".footerCheckout__payments"); this.payments = await waitElement(".footerCheckout__payments");
this.vtexpci = await waitElement(".footerCheckout__vtexpci"); this.vtexpci = await waitElement(".footerCheckout__vtexpci");
@ -70,12 +70,11 @@ export default class Footer {
let lista = this.list; let lista = this.list;
let cartTitle = this.cartTitle; let cartTitle = this.cartTitle;
console.log("title:", cartTitle);
if (target.style.display == "none" && window.location.hash == "#/cart") { if (target.style.display == "none" && window.location.hash == "#/cart") {
lista.style.display = "flex"; lista.style.display = "flex";
cartTitle.style.display = "block"; cartTitle.style.display = "block";
if (!this.list.classList.contains("fetch")) { if (!this.list.classList.contains("fetch")) {
console.log("PRIMEIRO NAO TEM FETCH");
this.fetchApiData(); this.fetchApiData();
} }
} else { } else {
@ -85,9 +84,7 @@ export default class Footer {
let config = { childList: true, attributes: true }; let config = { childList: true, attributes: true };
let observer = new MutationObserver((mutations) => { let observer = new MutationObserver((mutations) => {
if (window.location.hash == "#/cart") { if (window.location.hash == "#/cart") {
console.log("listairai", this.list.classList);
if (!lista.classList.contains("fetch")) { if (!lista.classList.contains("fetch")) {
console.log("SEGUNDO NAO TEM FETCH");
this.fetchApiData(); this.fetchApiData();
} }
mutations.forEach(function (mutation) { mutations.forEach(function (mutation) {
@ -104,7 +101,6 @@ export default class Footer {
lista.style.display = "flex"; lista.style.display = "flex";
cartTitle.style.display = "block"; cartTitle.style.display = "block";
} }
console.log(mutation.type);
}); });
} }
}); });
@ -113,7 +109,6 @@ export default class Footer {
} }
async addCarrossel() { async addCarrossel() {
console.log("start slick");
const elemento = await waitElement(".slick-test"); const elemento = await waitElement(".slick-test");
if ($(elemento).hasClass("slick-initialized")) { if ($(elemento).hasClass("slick-initialized")) {
$(elemento).slick("unslick"); $(elemento).slick("unslick");
@ -134,18 +129,14 @@ export default class Footer {
slidesToScroll: 1, slidesToScroll: 1,
}); });
} }
console.log("end slick");
} }
fetchApiData() { fetchApiData() {
console.log("COMEÇO FETCH");
fetch( fetch(
"https://m3academy.myvtex.com/api/catalog_system/pub/products/search/?fq=productClusterIds:319" "https://m3academy.myvtex.com/api/catalog_system/pub/products/search/?fq=productClusterIds:319"
) )
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
console.log(data);
const ul = document.createElement("ul"); const ul = document.createElement("ul");
ul.classList.add("slick-test"); ul.classList.add("slick-test");
@ -158,7 +149,6 @@ export default class Footer {
data.map((item) => { data.map((item) => {
let colors = ""; let colors = "";
for (let i = 0; i < item.items.length; i++) { for (let i = 0; i < item.items.length; i++) {
console.log(colors);
colors += `<p>${item.items[i].name}</p>`; colors += `<p>${item.items[i].name}</p>`;
} }
const li = document.createElement("li"); const li = document.createElement("li");
@ -170,18 +160,16 @@ export default class Footer {
${colors} ${colors}
</div> </div>
<a class="productLink" type="button" href="${item.link}">VER PRODUTO</a>`; <a class="productLink" type="button" href="${item.link}">VER PRODUTO</a>`;
console.log(item.productName, colors);
console.log("adiciona li");
ul.appendChild(li); ul.appendChild(li);
this.list.classList.add("fetch"); this.list.classList.add("fetch");
console.log(this.list);
ul.style.width = "100%"; ul.style.width = "100%";
}); });
}) })
.then(() => { .then(() => {
this.addCarrossel(); this.addCarrossel();
}); });
console.log("FIM FETCH");
} }
createPaymentsIcons() { createPaymentsIcons() {

View File

@ -95,14 +95,11 @@ export default class Header {
if (this.circle1.classList.contains("active")) { if (this.circle1.classList.contains("active")) {
this.circle1.classList.remove("active"); this.circle1.classList.remove("active");
} }
console.log("email shipping");
console.log(this.circle1);
if (this.circle2) { if (this.circle2) {
this.circle2.classList.add("active"); this.circle2.classList.add("active");
console.log("teste dados");
} }
console.log(this.circle2);
console.log(this.circle3);
if (this.circle3) { if (this.circle3) {
if (this.circle3.classList.contains("active")) { if (this.circle3.classList.contains("active")) {
this.circle3.classList.remove("active"); this.circle3.classList.remove("active");

View File

@ -537,6 +537,9 @@
padding: 0; padding: 0;
.box-step { .box-step {
.vtex-omnishipping-1-x-backToAddressList {
display: none;
}
.vtex-omnishipping-1-x-addressForm { .vtex-omnishipping-1-x-addressForm {
.vtex-omnishipping-1-x-address { .vtex-omnishipping-1-x-address {
display: flex; display: flex;

View File

@ -5,6 +5,13 @@
} }
.cart-template { .cart-template {
.summary-template-holder {
.row-fluid {
@media (max-width: 1024px) {
display: block !important;
}
}
}
@include mq(l, max) { @include mq(l, max) {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -64,6 +71,11 @@
border-top: none; border-top: none;
margin-top: 0; margin-top: 0;
padding-top: 0; padding-top: 0;
.description {
.pull-left {
display: none;
}
}
&:not(:first-child) { &:not(:first-child) {
margin-top: 8px; margin-top: 8px;