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.footerPrateleira = await waitElement(".footerCheckout__prateleira");
this.addSlick();
this.apiPrateleira();
await this.addCarrossel();
this.payments();
this.iconVtex();
this.developBy();
@ -40,11 +40,60 @@ export default class Footer {
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() {
const elemento = await waitElement("#my-element");
$(elemento).slick({
const idSlick = await waitElement("#footerCheckout__prateleira-ul-idSlick");
$(idSlick).slick({
slidesToShow: 4,
slidesToScroll: 1,
arrow: true,
Infinity: false,
});
}
@ -98,61 +147,4 @@ export default class Footer {
</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.titleMain = await waitElement("#cart-title");
this.pMain = await waitElement(".empty-cart-message");
//this.spanFrete = await waitElement(".shipping-estimate-date");
}
replacedNames() {
this.titleMain.innerHTML = "";
this.pMain.innerHTML = "";
//this.spanFrete.innerHTML = "a calcular";
}
progressBarHTML() {

View File

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

View File

@ -28,6 +28,7 @@
}
ul {
margin: 0px;
display: flex;
list-style-type: none;
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=Open+Sans:wght@300;400;500;600;700;800&display=swap");
$font-family: "Open Sans", sans-serif;
$font-family-secundary:"Tenor Sans", sans-serif;
$font-family-secundary: "Tenor Sans", sans-serif;
/* Colors */
$color-black: #292929;
@ -16,23 +16,24 @@ $color-gray4: #8d8d8d;
$color-gray5: #e5e5e5;
$color-blue: #4267b2;
$color-blue-figma: #00c8ff;
$color-green: #4caf50;
/* Grid breakpoints */
$grid-breakpoints: (
xs: 0,
cstm: 400,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px
xs: 0,
cstm: 400,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
) !default;
$z-index: (
level1: 5,
level2: 10,
level3: 15,
level4: 20,
level5: 25
level1: 5,
level2: 10,
level3: 15,
level4: 20,
level5: 25,
) !default;