fix: ajustes footer

This commit is contained in:
Caroline Moran 2022-12-13 17:00:25 -04:00
parent 8f628e83eb
commit b10dbaca3b
6 changed files with 381 additions and 134 deletions

View File

@ -8,10 +8,8 @@ export default class Footer {
async init() {
await this.selectors();
this.onUpdate();
this.checkoutPayments = await waitElement(".footerCheckout__payments");
this.checkoutVtexPci = await waitElement(".footerCheckout__vtexpci");
await this.footerPayments();
await this.vtexPci();
// document.addEventListener("onload", this.onUpdate.bind(this));
await this.footerItens();
}
async selectors() {
@ -19,20 +17,26 @@ export default class Footer {
this.checkoutVazio = await waitElement(".empty-cart-content");
}
onUpdateReload() {
const checkoutVazioTitle = document.querySelector("#cart-title");
if (
window.location.href === "https://m3academy.myvtex.com/checkout/#/cart" &&
this.checkoutVazio.style.display == "none"
) {
this.prateleiraHTML();
checkoutVazioTitle.style.display = "block";
}
if (this.checkoutVazio.style.display === "block") {
this.footerContainerPrateleira.innerHTML = "";
checkoutVazioTitle.style.display = "none";
}
}
onUpdate() {
this.onUpdateReload();
let observer = new MutationObserver((mutations) => {
console.log("oioioio");
mutations.forEach((mutationRecord) => {
console.log(mutationRecord);
if (
window.location.href === "https://m3academy.myvtex.com/checkout/#/cart" &&
this.checkoutVazio.style.display == "none"
) {
this.prateleiraHTML();
}
if (this.checkoutVazio.style.display == "block") {
this.footerContainerPrateleira.innerHTML = "";
}
this.onUpdateReload();
window.addEventListener("hashchange", () => {
if (
window.location.hash == "#/cart" &&
@ -50,7 +54,11 @@ export default class Footer {
});
});
observer.observe(this.checkoutVazio, { attributes: true, attributeFilter: ["style"] });
observer.observe(this.checkoutVazio, {
attributes: true,
attributeOldValue: true,
attributeFilter: ["style"],
});
}
prateleiraHTML() {
this.footerContainerPrateleira.innerHTML = `<h3>Você também pode gostar:</h3><ul id="prateleiraCheckout" class="footerCheckout__prateleira__wrapper"></ul>`;
@ -90,27 +98,84 @@ export default class Footer {
arrows: true,
infinite: false,
variableWidth: true,
responsive: [
{
breakpoint: 1025,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
infinite: false,
},
},
{
breakpoint: 601,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
},
},
{
breakpoint: 361,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
},
},
],
});
}
}
async footerPayments() {
if (this.checkoutPayments) {
this.checkoutPayments.innerHTML = `
<figure>
<img src="https://agenciamagma.vteximg.com.br/arquivos/masterCardM3Academy.png">
<img src="https://agenciamagma.vteximg.com.br/arquivos/visaM3Academy.png">
<img src="https://agenciamagma.vteximg.com.br/arquivos/amexM3Academy.png">
<img src="https://agenciamagma.vteximg.com.br/arquivos/eloM3Academy.png">
<img src="https://agenciamagma.vteximg.com.br/arquivos/hiperCardM3Academy.png">
<img src="https://agenciamagma.vteximg.com.br/arquivos/payPalM3Academy.png">
<img src="https://agenciamagma.vteximg.com.br/arquivos/boletoM3Academy.png">
</figure>`;
async footerItens() {
const checkoutPayments = await waitElement(".footerCheckout__payments", {
timeout: 5000,
interval: 1000,
});
const checkoutVtexPci = await waitElement(".footerCheckout__vtexpci", {
timeout: 5000,
interval: 1000,
});
if (checkoutPayments) {
checkoutPayments.innerHTML = `<ul>
<li>
<figure class="pequeno">
<img src="https://agenciamagma.vteximg.com.br/arquivos/masterCardM3Academy.png">
</figure>
</li>
<li>
<figure class="mini">
<img src="https://agenciamagma.vteximg.com.br/arquivos/visaM3Academy.png">
</figure>
</li>
<li>
<figure class="mini">
<img src="https://agenciamagma.vteximg.com.br/arquivos/amexM3Academy.png">
</figure>
</li>
<li>
<figure class="medio">
<img src="https://agenciamagma.vteximg.com.br/arquivos/eloM3Academy.png">
</figure>
</li>
<li>
<figure class="mini">
<img src="https://agenciamagma.vteximg.com.br/arquivos/hiperCardM3Academy.png">
</figure>
</li>
<li>
<figure class="pequeno">
<img src="https://agenciamagma.vteximg.com.br/arquivos/payPalM3Academy.png">
</figure>
</li>
<li>
<figure class="pequeno">
<img src="https://agenciamagma.vteximg.com.br/arquivos/boletoM3Academy.png">
</figure>
</li>
</ul>`;
}
}
async vtexPci() {
if (this.checkoutVtexPci) {
this.checkoutVtexPci.innerHTML = `
if (checkoutVtexPci) {
checkoutVtexPci.innerHTML = `
<figure>
<img src="https://agenciamagma.vteximg.com.br/arquivos/vtexPciM3Academy.png">
</figure>`;

View File

@ -1,38 +1,45 @@
.empty-cart {
font-family: $font-family;
&-content {
color: $color-black;
text-align: center;
font-family: $font-family;
&-content {
color: $color-black;
text-align: center;
@include mq(md, max) {
padding: 0 16px;
}
}
@include mq(md, max) {
padding: 0 16px;
}
}
&-title {
font-size: 20px;
}
&-title {
font-weight: 700;
font-size: 24px;
line-height: 33px;
text-align: center;
text-transform: uppercase;
color: #000000;
}
&-message {
display: none;
}
&-links {
.link-choose-products {
background: $color-black;
border: none;
border-radius: 5px;
transition: ease-in 0.22s all;
outline: none;
font-family: $font-family;
font-style: normal;
font-weight: 500;
font-size: 14px;
line-height: 16px;
text-align: center;
letter-spacing: 0.05em;
color: $color-white;
text-transform: uppercase;
&-links {
.link-choose-products {
background: $color-black;
border: none;
border-radius: 5px;
transition: ease-in 0.22s all;
outline: none;
font-family: $font-family;
font-style: normal;
font-weight: 500;
font-size: 14px;
line-height: 16px;
text-align: center;
letter-spacing: 0.05em;
color: $color-white;
text-transform: uppercase;
&:hover {
background: lighten($color-black, 5);
}
}
}
&:hover {
background: lighten($color-black, 5);
}
}
}
}

View File

@ -9,12 +9,17 @@ html {
}
footer .footerCheckout__wrapper .container {
width: 94.9734%;
width: 95%;
margin: auto auto 0 auto;
@media (max-width: 1024px) {
width: 100%;
padding: 0 8px;
}
}
header {
border-bottom: 1px solid #000;
}
footer .footerCheckout__prateleira,
.headerCheckout .container {
width: 79.53125%;
@ -23,7 +28,13 @@ footer .footerCheckout__prateleira,
width: auto;
}
}
footer .footerCheckout__prateleira {
width: 79.375%;
@media (max-width: 1024px) {
width: auto;
padding: 0 16px;
}
}
body {
display: flex;
flex-direction: column;

View File

@ -105,14 +105,38 @@
.slick-prev {
background: url("https://agenciamagma.vteximg.com.br/arquivos/arrow-left-mini-M3Academy.svg")
no-repeat center center;
background-size: 100%;
z-index: 4;
left: 10px;
width: 13.64px;
height: 29.47px;
@media (min-width: 2500px) {
background: url("https://agenciamagma.vteximg.com.br/arquivos/arrow-left-M3Academy.svg")
no-repeat center center;
width: 26px;
height: 57.99px;
}
@media (max-width: 600px) {
left: 0px;
}
}
.slick-next {
background: url("https://agenciamagma.vteximg.com.br/arquivos/arrow-right-mini-M3Academy.svg")
no-repeat center center;
background-size: 100%;
z-index: 4;
right: 10px;
width: 13.64px;
height: 29.47px;
@media (min-width: 2500px) {
background: url("https://agenciamagma.vteximg.com.br/arquivos/arrow-right-M3Academy.svg")
no-repeat center center;
width: 26px;
height: 57.99px;
}
@media (max-width: 600px) {
right: 0px;
}
}
.slick-arrow.slick-hidden {
display: none !important;

View File

@ -8,7 +8,17 @@
justify-content: center;
flex-direction: column;
h3 {
font-size: 32px;
font-family: $font-family-secundary;
font-style: normal;
font-weight: 400;
font-size: 24px;
line-height: 38px;
text-align: center;
color: #000000;
@media (min-width: 2500px) {
font-size: 48px;
line-height: 76px;
}
}
ul {
margin: 0;
@ -18,7 +28,7 @@
display: flex;
justify-content: space-between;
width: 100%;
padding: 50px 0;
padding: 20px 0 54px;
li {
list-style-type: none;
@ -30,25 +40,73 @@
}
&__produto {
width: 242px !important;
@media (min-width: 2500px) {
width: 488.07px !important;
}
@media (max-width: 1024px) {
width: 320px !important;
}
@media (max-width: 600px) {
width: 164px !important;
}
ul {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 20px;
.name {
font-family: $font-family;
font-style: normal;
font-weight: 400;
font-size: 13px;
line-height: 18px;
text-align: center;
color: #000000;
@media (min-width: 2500px) {
font-size: 26px;
line-height: 35px;
}
}
.skus {
display: flex;
align-items: center;
justify-content: center;
gap: 5px;
@media (max-width: 600px) {
width: 92%;
min-height: 61px;
flex-wrap: wrap;
}
li {
padding: 5px;
font-weight: 700;
font-size: 13px;
line-height: 18px;
letter-spacing: 0.05em;
text-transform: uppercase;
@media (min-width: 2500px) {
font-size: 26px;
line-height: 35px;
}
}
}
.skus li,
.verProdBtn a {
color: #fff;
font-weight: 500;
font-family: $font-family;
color: #ffffff;
}
.verProdBtn a {
font-weight: 700;
font-size: 13px;
line-height: 18px;
letter-spacing: 0.05em;
text-transform: uppercase;
@media (min-width: 2500px) {
font-size: 26px;
line-height: 35px;
}
}
.skus li,
.verProdBtn {
@ -68,122 +126,204 @@
align-items: center;
display: flex;
justify-content: space-between;
border-top: 1px solid #000000;
padding: 16px 0;
.container {
align-items: center;
display: flex;
justify-content: space-between;
@media (max-width: 1024px) {
flex-direction: column;
align-items: flex-start;
}
@media (max-width: 490px) {
padding: 0 8px !important;
}
}
}
&__address {
color: $color-gray2;
font-family: $font-family;
font-style: normal;
font-weight: normal;
font-weight: 400;
font-size: 10px;
line-height: 12px;
line-height: 14px;
text-transform: capitalize;
max-width: 40%;
@include mq(md, max) {
margin-bottom: 24px;
max-width: 100%;
color: #292929;
width: 33%;
span {
width: 66.36%;
}
@media (min-width: 2500px) {
font-size: 20px;
line-height: 27px;
}
@media (max-width: 1024px) {
margin: 16px 0 16px 8px;
order: 2;
width: 100%;
}
}
&__stamps {
align-items: center;
display: flex;
justify-self: center;
justify-content: center;
list-style: none;
@include mq(md, max) {
align-self: center;
margin-bottom: 12px;
width: 33%;
margin: 0;
@media (max-width: 1024px) {
width: 100%;
order: 1;
}
&__divider {
background-color: $color-gray4;
display: inline-block;
height: 24px;
margin: 0 8px;
margin: 0 10px 0 13.35px;
width: 1px;
@media (min-width: 2500px) {
margin: 0 10px 0 13.37px;
height: 42.99px;
}
@media (max-width: 1024px) {
margin: 0 10px 0 4.37px;
height: 24px;
}
}
}
&__vtexpci {
figure {
width: 53px;
img {
width: 100%;
}
}
}
&__vtexpci,
&__payments {
font-size: 0;
img {
display: flex;
align-items: center;
figure {
margin: 0;
}
}
&__payments ul {
display: flex;
align-items: center;
list-style: none;
gap: 13.22px;
margin: 0;
@media (max-width: 1024px) {
gap: 5px;
}
li {
width: auto;
}
figure.mini {
width: 34.78px;
@media (min-width: 2500px) {
width: 67.93px;
}
}
figure.pequeno {
width: 35.65px;
@media (min-width: 2500px) {
width: 69.63px;
}
}
figure.medio {
width: 36.52px;
@media (min-width: 2500px) {
width: 71.33px;
}
}
}
&__developedBy {
align-items: center;
display: flex;
justify-content: flex-end;
list-style-type: none;
margin: 0;
width: 33%;
gap: 10.73px;
@media (max-width: 1024px) {
justify-content: flex-start;
margin: 0 0 0 8px;
order: 3;
width: 100%;
}
li:first-child {
// margin-left: 16px;
width: auto;
a {
span {
display: flex;
&::after {
content: "";
background: url("https://agenciamagma.vteximg.com.br/arquivos/logoVTEXM3Academy.png")
no-repeat center center;
display: block;
width: 16px;
height: 16px;
display: flex;
&::after {
content: "";
background: url("https://agenciamagma.vteximg.com.br/arquivos/logoVTEXM3Academy.png")
no-repeat center center;
background-size: 100%;
display: block;
width: 44.92px;
height: 16px;
@media (min-width: 2500px) {
height: 31.24px;
width: 87.73px;
}
}
span {
margin-right: 10.12px;
}
}
}
li:last-child {
// margin-left: 16px;
width: auto;
a {
span {
display: flex;
&::after {
content: "";
background: url("https://agenciamagma.vteximg.com.br/arquivos/logoM3M3Academy.png")
no-repeat center center;
display: block;
width: 16px;
height: 16px;
display: flex;
&::after {
content: "";
background: url("https://agenciamagma.vteximg.com.br/arquivos/logoM3M3Academy.png")
no-repeat center center;
background-size: 100%;
display: block;
width: 28.66px;
height: 15.65px;
@media (min-width: 2500px) {
height: 30.55px;
width: 55.98px;
}
}
span {
margin-right: 10.95px;
}
}
}
a {
align-items: center;
color: $color-gray2;
display: flex;
font-family: $font-family;
font-style: normal;
font-weight: normal;
font-size: 0px;
line-height: 12px;
text-decoration: none;
align-items: center;
justify-content: flex-end;
span {
margin-right: 8px;
font-family: $font-family;
font-style: normal;
font-weight: 400;
font-size: 9px;
line-height: 12px;
color: #292929;
&::after {
content: "";
background: url("https://agenciamagma.vteximg.com.br/arquivos/logoVTEXM3Academy.png")
no-repeat center center;
display: block;
width: 44.92px;
height: auto;
width: auto;
@media (min-width: 2500px) {
font-size: 18px;
line-height: 25px;
}
}
}

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;
@ -12,7 +12,7 @@ $color-white: #fff;
$color-gray: #6c6c6c;
$color-gray2: #7d7d7d;
$color-gray3: #f0f0f0;
$color-gray4: #8d8d8d;
$color-gray4: #c4c4c4;
$color-gray5: #e5e5e5;
$color-blue: #4267b2;
@ -21,18 +21,18 @@ $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;