feat(cart-fill): created intial styles and product self not styled and fix header,footer,checkout-empty

This commit is contained in:
Henrique Santos Santana 2022-12-15 19:45:22 -03:00
parent cf15ad2f14
commit 27a64b361b
6 changed files with 104 additions and 57 deletions

View File

@ -87,19 +87,22 @@ export default class Footer {
// sempre que o carrinho estiver vazio o elemento chcekoutVazio fica display: none e isso pode ser usado como atributo para a MutationObserver // sempre que o carrinho estiver vazio o elemento chcekoutVazio fica display: none e isso pode ser usado como atributo para a MutationObserver
if (this.checkoutEmpty && this.checkoutContainer) { if (this.checkoutEmpty && this.checkoutContainer) {
if (this.checkoutContainer.classList.contains("container-cart-fill")) { if (this.checkoutEmpty.style.display === "none") {
this.checkoutContainer.classList.remove("container-cart-fill");
} else {
this.checkoutContainer.classList.add("container-cart-fill"); this.checkoutContainer.classList.add("container-cart-fill");
} else {
this.checkoutContainer.classList.remove("container-fill");
} }
if ( if (
window.location.href.endsWith("#/cart") && this.checkoutContainer.classList.contains("container-cart-fill") &&
this.checkoutContainer.classList.contains("container-cart-fill") this.checkoutContainer.classList.contains("container-cart") &&
window.location.href.endsWith("#/cart")
) { ) {
console.log("API"); this.innerSelfList();
this.innerToSelf(); this.innerToSelf();
this.addCarrossel(); this.addCarrossel();
} else {
this.self.innerHTML = "";
} }
let target = this.checkoutEmpty; let target = this.checkoutEmpty;
@ -107,18 +110,22 @@ export default class Footer {
let observer = new MutationObserver((mutations) => { let observer = new MutationObserver((mutations) => {
for (let i = 0; i < mutations.length; i++) { for (let i = 0; i < mutations.length; i++) {
if (mutations[i].attributeName === "style") { if (mutations[i].attributeName === "style") {
if (this.checkoutContainer.classList.contains("container-cart-fill")) { if (this.checkoutEmpty.style.display === "none") {
this.checkoutContainer.classList.remove("container-cart-fill");
} else {
this.checkoutContainer.classList.add("container-cart-fill"); this.checkoutContainer.classList.add("container-cart-fill");
} else {
this.checkoutContainer.classList.remove("container-cart-fill");
} }
if ( if (
window.location.href.endsWith("#/cart") && this.checkoutContainer.classList.contains("container-cart-fill") &&
this.checkoutContainer.classList.contains("container-cart-fill") this.checkoutContainer.classList.contains("container-cart") &&
window.location.href.endsWith("#/cart")
) { ) {
this.innerSelfList();
this.innerToSelf(); this.innerToSelf();
this.addCarrossel(); this.addCarrossel();
} else {
this.self.innerHTML = "";
} }
break; break;
@ -127,13 +134,43 @@ export default class Footer {
}); });
observer.observe(target, config); observer.observe(target, config);
window.addEventListener("hashchange", () => {
if (
this.checkoutContainer.classList.contains("container-cart-fill") &&
this.checkoutContainer.classList.contains("container-cart") &&
window.location.href.endsWith("#/cart")
) {
this.innerSelfList();
this.innerToSelf();
this.addCarrossel();
} else {
this.self.innerHTML = "";
}
});
} }
} }
addCarrossel() { addCarrossel() {
$(this.self).slick({ $(this.self.children[1]).slick({
slidesToShow: 4, slidesToShow: 4,
slidesToScroll: 1, slidesToScroll: 1,
arrows: true,
responsive: [
{
breakpoint: 1025,
settings: {
slidesToShow: 3,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
},
},
],
}); });
} }
@ -154,7 +191,7 @@ export default class Footer {
let datas = await this.getProducts(); let datas = await this.getProducts();
datas.forEach(() => { datas.forEach(() => {
$(this.self).slick("unslick"); $(this.self.children[1]).slick("unslick");
this.createdCardsProducts(datas); this.createdCardsProducts(datas);
@ -166,7 +203,8 @@ export default class Footer {
let structure = ""; let structure = "";
data.forEach((data) => { data.forEach((data) => {
structure += `<div> structure += `<li>
<div>
<div> <div>
<figure> <figure>
<img src="${data.items[0].images[0].imageUrl}" alt=""> <img src="${data.items[0].images[0].imageUrl}" alt="">
@ -190,9 +228,19 @@ export default class Footer {
Ver Produto Ver Produto
</span> </span>
</a> </a>
</div>`; </div></li>`;
}); });
this.self.innerHTML = structure.trim(); this.self.children[1].innerHTML = `
${structure.trim()}
`;
}
innerSelfList() {
this.self.innerHTML = `
<div>
<h2>Você também pode gostar:</h2>
</div>
<ul class="self-list"></ul>`;
} }
} }

View File

@ -29,7 +29,6 @@ function OnProgress(target) {
<div class="progress-content"> <div class="progress-content">
<p>Dados Pessoais</p> <p>Dados Pessoais</p>
<span class="progress-bullet"></span> <span class="progress-bullet"></span>
<span class="progress-line"></span>
</div> </div>
</div> </div>
</li> </li>

View File

@ -1,9 +1,10 @@
.container { .container-cart.container-cart-fill {
@include mq(md, max) { width: 100%;
width: 100%;
#cart-title {
display: flex !important;
} }
} }
.cart-template { .cart-template {
font-family: $font-family-100; font-family: $font-family-100;
@include mq(md, max) { @include mq(md, max) {

View File

@ -10,9 +10,10 @@
background-color: $clr-common-white; background-color: $clr-common-white;
} }
.container-cart { .container-main.container-cart {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 0 16px !important;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -21,43 +22,37 @@
#cart-title { #cart-title {
display: none !important; display: none !important;
} }
.cart-template,
.checkout-container {
min-height: auto;
}
.checkout-container {
padding: 0 16px;
}
.checkout-container,
.cart-template { .cart-template {
min-height: auto;
margin: 0; margin: 0;
} }
@media screen and (min-width: 375px) { .link-choose-products {
.checkout-container { width: fluid(250px, 343px);
width: fluid(300px, 375px); max-width: 250px;
margin: 0 auto; margin: 0 auto;
} }
.link-choose-products { .transactions-container {
width: fluid(250px, 300px); display: none;
max-width: 250px;
margin: 0 auto;
}
} }
@media screen and (min-width: 1025px) { @media screen and (min-width: 1025px) {
.checkout-container { width: fluid(400px, 1280px);
width: fluid(400px, 1280px); padding: 0 !important;
padding: 0; max-width: none;
}
.link-choose-products { .link-choose-products {
width: fluid(327px, 400px); width: fluid(327px, 400px);
max-width: none; max-width: 327px;
} }
} }
@media screen and (min-width: 2500px) {
width: fluid(659px, 2500px);
}
} }
.empty-cart { .empty-cart {

View File

@ -1,15 +1,15 @@
.footerCheckout { .footerCheckout {
padding: 16px 25px 18.88px 8px;
@include mq("md", min) {
padding: 16px 0;
}
}
.footerCheckout {
border-top: 1px solid $clr-common-black;
color: $clr-gray-400; color: $clr-gray-400;
&__wrapper {
border-top: 1px solid $clr-common-black;
padding: 16px 25px 18.88px 8px;
@include mq("md", min) {
padding: 16px 0;
}
}
&__stamps { &__stamps {
order: 0; order: 0;
margin: 0 0 16px; margin: 0 0 16px;

View File

@ -161,7 +161,7 @@ body :where(ul, li, ol) {
.progress-item { .progress-item {
&--left, &--left,
&--right { &--right {
width: 39.9183%; width: 40%;
.progress-line { .progress-line {
position: absolute; position: absolute;
@ -183,14 +183,18 @@ body :where(ul, li, ol) {
} }
} }
&--center {
width: 90px;
}
&--right { &--right {
.progress-container { .progress-container {
align-items: flex-end; align-items: flex-end;
} }
.progress-line { .progress-line {
left: 29%; right: 72%;
transform: translateX(-50%); transform: translateX(50%);
} }
} }
} }