feature(slick) Adicionando o slick

This commit is contained in:
Douglas Vinicius Nobrega 2022-12-17 16:55:36 -03:00
parent c7d77b4f8c
commit 51fa6f2538
5 changed files with 142 additions and 104 deletions

View File

@ -12,8 +12,8 @@ export default class Footer {
this.footerDevelopBy = await waitElement(".footerCheckout__developedBy"); this.footerDevelopBy = await waitElement(".footerCheckout__developedBy");
this.footerPrateleira = await waitElement(".footerCheckout__prateleira"); this.footerPrateleira = await waitElement(".footerCheckout__prateleira");
this.addSlick();
this.apiPrateleira(); this.apiPrateleira();
await this.addCarrossel();
this.payments(); this.payments();
this.iconVtex(); this.iconVtex();
this.developBy(); this.developBy();
@ -40,11 +40,60 @@ export default class Footer {
observer.observe(target, config); observer.observe(target, config);
} }
apiPrateleira() {
this.footerPrateleira.innerHTML = `
<h2 class="footerCheckout__prateleira-title">Você também pode gostar:</h2>
<ul class="footerCheckout__prateleira-ul" id="footerCheckout__prateleira-ul-idSlick"></ul>
`;
const api =
"https://m3academy.myvtex.com/api/catalog_system/pub/products/search/?fq=productClusterIds:319";
const ulProd = document.querySelector(".footerCheckout__prateleira-ul");
fetch(api)
.then((reponse) => {
return reponse.json();
})
.then((data) => {
data.forEach((prod) => {
const imgUl = prod.items[0].images[0].imageUrl;
const nameUl = prod.productName;
const linkUl = prod.link;
ulProd.innerHTML += `
<li class="footerCheckout__prateleira-li-ulProd">
<figure class="footerCheckout__prateleira-figure-ulProd">
<img src="${imgUl}" alt="Imagem Produto" >
</figure>
<div class="footerCheckout__prateleira-div-text">
<h3>${nameUl}</h3>
<ul>
${prod.items
.map(
(name) => `<li>
${name.name} </li>`
)
.join("")}
</ul>
<a href=${linkUl}>
Ver produto
</a>
</div>
</li>
`;
});
});
}
async addCarrossel() { async addCarrossel() {
const elemento = await waitElement("#my-element"); const idSlick = await waitElement("#footerCheckout__prateleira-ul-idSlick");
$(elemento).slick({
$(idSlick).slick({
slidesToShow: 4, slidesToShow: 4,
slidesToScroll: 1, slidesToScroll: 1,
arrow: true,
Infinity: false,
}); });
} }
@ -98,61 +147,4 @@ export default class Footer {
</ul> </ul>
`; `;
} }
apiPrateleira() {
this.footerPrateleira.innerHTML = `
<h2 class="footerCheckout__prateleira-title">Você também pode gostar:</h2>
<ul class="footerCheckout__prateleira-ul" id="footerCheckout__prateleira-ul-id"></ul>
`;
const api =
"https://m3academy.myvtex.com/api/catalog_system/pub/products/search/?fq=productClusterIds:319";
const ulProd = document.querySelector(".footerCheckout__prateleira-ul");
fetch(api)
.then((reponse) => {
return reponse.json();
})
.then((data) => {
data.forEach((prod) => {
const imgUl = prod.items[0].images[0].imageUrl;
const nameUl = prod.productName;
const linkUl = prod.link;
ulProd.innerHTML += `
<li class="footerCheckout__prateleira-li-ulProd">
<figure class="footerCheckout__prateleira-figure-ulProd">
<img src="${imgUl}" alt="Imagem Produto" >
</figure>
<div class="footerCheckout__prateleira-div-text" >
<h3>${nameUl}</h3>
<ul>
${prod.items
.map(
(name) => `<li>
${name.name} </li>`
)
.join("")}
</ul>
<a href=${linkUl}>
Ver produto
</a>
</div>
</li>
`;
});
});
}
async addSlick() {
const idSlick = await waitElement("#footerCheckout__prateleira-ul-id");
if (window.screen.width > 1024) {
$(idSlick).slick({
slidesToScroll: 4,
slidesToScroll: 1,
infinite: false,
arrows: true,
});
}
}
} }

View File

@ -18,11 +18,14 @@ export default class Header {
this.progressBar = await waitElement("#progressBar"); this.progressBar = await waitElement("#progressBar");
this.titleMain = await waitElement("#cart-title"); this.titleMain = await waitElement("#cart-title");
this.pMain = await waitElement(".empty-cart-message"); this.pMain = await waitElement(".empty-cart-message");
//this.spanFrete = await waitElement(".shipping-estimate-date");
} }
replacedNames() { replacedNames() {
this.titleMain.innerHTML = ""; this.titleMain.innerHTML = "";
this.pMain.innerHTML = ""; this.pMain.innerHTML = "";
//this.spanFrete.innerHTML = "a calcular";
} }
progressBarHTML() { progressBarHTML() {

View File

@ -5,7 +5,6 @@
} }
.cart-template { .cart-template {
font-family: $font-family;
@include mq(md, max) { @include mq(md, max) {
padding: 0 0; padding: 0 0;
} }
@ -13,7 +12,8 @@
display: none; display: none;
} }
.cart { .cart {
border: 3px solid $color-gray3; font-family: $font-family-secundary;
border: 1px solid $color-gray3;
box-sizing: border-box; box-sizing: border-box;
border-radius: 5px; border-radius: 5px;
padding: 16px; padding: 16px;
@ -110,14 +110,34 @@
padding: 16px 0; padding: 16px 0;
} }
.shipping-estimate-date {
font-size: 0px;
&:before {
content: "a calcular";
font-size: 12px;
}
&.shipping-estimate-detail {
font-size: 0px;
}
}
th { th {
color: $color-black; color: $color-black;
padding: 0 0 16px; padding: 0 0 16px;
font-family: "Tenor Sans";
font-style: normal; font-style: normal;
font-weight: bold; font-weight: 400;
font-size: 14px; font-size: 14px;
line-height: 16px; line-height: 16px;
&.shipping-date {
font-size: 0px;
&:before {
content: "Frete";
font-size: 14px;
}
}
@include mq(md, max) { @include mq(md, max) {
&.quantity-price, &.quantity-price,
&.shipping-date { &.shipping-date {
@ -217,8 +237,8 @@
td.quantity { td.quantity {
align-items: center; align-items: center;
border: 1px solid $color-gray3; border: 1px solid #f0f0f0;
border-radius: 0; border-radius: 8px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -233,10 +253,11 @@
} }
input { input {
background-color: $color-white; //background-color: $color-white;
border: 1px solid $color-gray3; font-family: "Tenor Sans";
border-radius: 0; border: 0px solid $color-gray3;
border-width: 0 1px; //border-radius: 0;
//border-width: 0 1px;
display: block; display: block;
max-height: 38px; max-height: 38px;
margin: 0 !important; margin: 0 !important;
@ -253,14 +274,14 @@
.icon-plus-sign, .icon-plus-sign,
.icon-minus-sign { .icon-minus-sign {
&::before { &::before {
color: $color-black; color: #00c8ff;
display: block; display: block;
font-weight: 500; font-weight: 500;
padding: 1px 12px; padding: 1px 12px;
} }
} }
.icon-minus-sign { /*.icon-minus-sign {
&:before { &:before {
content: "-"; content: "-";
font-size: 16px; font-size: 16px;
@ -272,7 +293,7 @@
content: "+"; content: "+";
font-size: 14px; font-size: 14px;
} }
} }*/
.item-quantity-change { .item-quantity-change {
@media (max-width: 979px) and (min-width: 768px) { @media (max-width: 979px) and (min-width: 768px) {
@ -297,7 +318,7 @@
} }
span { span {
font-style: normal; font-style: normal;
font-weight: normal; font-weight: bold;
font-size: 14px; font-size: 14px;
line-height: 16px; line-height: 16px;
color: $color-black; color: $color-black;
@ -356,7 +377,7 @@
font-weight: normal; font-weight: normal;
font-size: 24px; font-size: 24px;
line-height: 28px; line-height: 28px;
color: $color-gray2; color: $color-black;
@include mq(md, max) { @include mq(md, max) {
margin-top: 0; margin-top: 0;
@ -441,6 +462,11 @@
font-size: 14px; font-size: 14px;
line-height: 16px; line-height: 16px;
text-transform: uppercase; text-transform: uppercase;
/*&:before {
content: "Calcular";
font-size: 16px;
}*/
} }
&__current { &__current {
@ -591,6 +617,7 @@
} }
&-totalizers { &-totalizers {
font-family: $font-family-secundary;
padding: 0; padding: 0;
width: 346px; width: 346px;
@ -603,12 +630,12 @@
} }
} }
span { span {
font-family: $font-family; //font-family: $font-family-secundary;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: 400;
font-size: 12px; font-size: 12px;
line-height: 14px; line-height: 14px;
color: $color-blue; color: $color-black;
text-decoration: none; text-decoration: none;
} }
} }
@ -630,8 +657,10 @@
} }
.coupon-label label { .coupon-label label {
justify-content: flex-start;
display: flex;
margin-bottom: 12px; margin-bottom: 12px;
font-family: $font-family; font-family: $font-family-secundary;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
font-size: 12px; font-size: 12px;
@ -642,6 +671,12 @@
.coupon-fields { .coupon-fields {
margin-bottom: 32px; margin-bottom: 32px;
display: flex;
.coupon-fields span {
display: flex;
gap: 15px;
}
@include mq(sm, max) { @include mq(sm, max) {
span { span {
@ -657,14 +692,15 @@
} }
input { input {
font-family: $font-family-secundary;
border: 2px solid $color-gray3; border: 2px solid $color-gray3;
border-radius: 5px; border-radius: 5px;
box-shadow: none; box-shadow: none;
color: $color-gray4; color: $color-gray4;
font-size: 12px; font-size: 12px;
height: 34px; height: 36px;
padding: 0 12px; padding: 0 12px;
max-width: 160px; width: 204px;
@include mq(sm, max) { @include mq(sm, max) {
max-width: 100%; max-width: 100%;
@ -673,17 +709,21 @@
} }
button { button {
background: $color-black; background: $color-blue-figma;
font-family: $font-family;
color: $color-black !important;
border: none; border: none;
border-radius: 5px; border-radius: 8px;
color: $color-white; color: $color-white;
font-size: 12px; font-size: 14px;
font-weight: 400;
line-height: 19px;
height: 36px; height: 36px;
letter-spacing: 1px; letter-spacing: 1px;
margin-left: 6px; margin-left: -8px;
outline: none; outline: none;
transition: all 0.2s linear; transition: all 0.2s linear;
width: 94px; width: 134px;
text-transform: uppercase; text-transform: uppercase;
@include mq(md, max) { @include mq(md, max) {
@ -733,10 +773,11 @@
tfoot { tfoot {
td.info, td.info,
td.monetary { td.monetary {
font-family: $font-family;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: 700;
font-size: 18px; font-size: 18px;
line-height: 21px; line-height: 25px;
color: $color-black; color: $color-black;
} }
} }
@ -776,13 +817,13 @@
font-weight: normal; font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 14px; line-height: 14px;
color: $color-blue; color: $color-black;
} }
} }
.btn-place-order-wrapper { .btn-place-order-wrapper {
a { a {
background: $color-green; background: $color-blue-figma;
border: none; border: none;
border-radius: 5px; border-radius: 5px;
display: block; display: block;
@ -797,10 +838,10 @@
&:after { &:after {
content: "finalizar compra"; content: "finalizar compra";
font-family: $font-family; font-family: $font-family;
font-weight: 500; font-weight: 700;
font-size: 13px; font-size: 14px;
letter-spacing: 0.05em; letter-spacing: 0.05em;
color: $color-white; color: $color-black;
text-transform: uppercase; text-transform: uppercase;
vertical-align: middle; vertical-align: middle;
line-height: 19px; line-height: 19px;

View File

@ -28,6 +28,7 @@
} }
ul { ul {
margin: 0px;
display: flex; display: flex;
list-style-type: none; list-style-type: none;
gap: 16px; gap: 16px;

View File

@ -2,7 +2,7 @@
@import url("https://fonts.googleapis.com/css2?family=Tenor+Sans&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Tenor+Sans&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap");
$font-family: "Open Sans", sans-serif; $font-family: "Open Sans", sans-serif;
$font-family-secundary:"Tenor Sans", sans-serif; $font-family-secundary: "Tenor Sans", sans-serif;
/* Colors */ /* Colors */
$color-black: #292929; $color-black: #292929;
@ -16,23 +16,24 @@ $color-gray4: #8d8d8d;
$color-gray5: #e5e5e5; $color-gray5: #e5e5e5;
$color-blue: #4267b2; $color-blue: #4267b2;
$color-blue-figma: #00c8ff;
$color-green: #4caf50; $color-green: #4caf50;
/* Grid breakpoints */ /* Grid breakpoints */
$grid-breakpoints: ( $grid-breakpoints: (
xs: 0, xs: 0,
cstm: 400, cstm: 400,
sm: 576px, sm: 576px,
md: 768px, md: 768px,
lg: 992px, lg: 992px,
xl: 1200px xl: 1200px,
) !default; ) !default;
$z-index: ( $z-index: (
level1: 5, level1: 5,
level2: 10, level2: 10,
level3: 15, level3: 15,
level4: 20, level4: 20,
level5: 25 level5: 25,
) !default; ) !default;