feat: Adiciona o minicart

This commit is contained in:
Filipe Quintanilha Evangelista 2022-12-07 19:35:49 -03:00
parent 3bd2e842ef
commit 69b5845241
5 changed files with 82 additions and 67 deletions

View File

@ -64,7 +64,7 @@ const app = new Container({
], ],
}); });
app.bind(Minicart.name, ".carrinho .mini-cart"); app.bind(Minicart.name, ".minicart__drawer");
app.bind(Newsletter.name, { app.bind(Newsletter.name, {
elemento: ".news-form", elemento: ".news-form",
textButtom: "Cadastre-se", textButtom: "Cadastre-se",

View File

@ -290,8 +290,6 @@ export default class Minicart {
} }
this.createMiniCartStructure(element); this.createMiniCartStructure(element);
this.configureEvents( this.configureEvents(".minicart__button");
"header .carrinho> a, .mobile-bottom-options .portal-totalizers-ref, .popup-add-cart .cart"
);
} }
} }

View File

@ -1,21 +1,66 @@
.mini-cart { .minicart {
height: 475px; position: relative;
max-height: 200px;
opacity: 0;
position: absolute;
right: 0px;
top: 50px;
transition: all 0.3s ease-in-out;
visibility: hidden;
width: 375px;
z-index: 16;
@include mq(md, max) { &__button {
bottom: 0; position: relative;
height: 100%; padding: 0;
left: 0; border: 0;
position: fixed; outline: 0;
top: 0; background: transparent;
cursor: pointer;
.portal-totalizers-ref {
.title,
.amount-products,
.amount-items strong,
.amount-kits,
.total-cart {
display: none;
}
}
.cart-info {
margin: 0;
}
.amount-items-em {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 4px;
right: -4px;
width: 15px;
height: 15px;
border-radius: 50%;
font-style: normal;
font-weight: 700;
font-size: 9px;
line-height: 11px;
color: $white-500;
background: $blue-500;
}
}
&__drawer {
height: 475px;
max-height: 200px;
opacity: 0;
position: absolute;
right: 0px;
top: 80px;
transition: all 0.3s ease-in-out;
visibility: hidden;
width: 375px;
z-index: 16;
@include mq(md, max) {
bottom: 0;
height: 100%;
left: 0;
position: fixed;
top: 0;
}
} }
} }
@ -380,7 +425,7 @@
} }
.finish-order { .finish-order {
background-color: #2fab61; background-color: $black-500;
color: #fff; color: #fff;
display: block; display: block;
font-weight: 700; font-weight: 700;
@ -392,12 +437,18 @@
width: 100%; width: 100%;
&:hover { &:hover {
background-color: lighten(#2fab61, 2.5); background-color: lighten($black-500, 2.5);
} }
&:active { &:active {
background-color: darken(#2fab61, 10); background-color: darken($black-500, 10);
} }
} }
} }
&.have-item {
.totals-container {
display: block;
}
}
} }

View File

@ -67,45 +67,6 @@
} }
} }
} }
&__minicart-button {
position: relative;
padding: 0;
border: 0;
outline: 0;
background: transparent;
.portal-totalizers-ref {
.title,
.amount-products,
.amount-items strong,
.amount-kits,
.total-cart {
display: none;
}
}
.cart-info {
margin: 0;
}
.amount-items-em {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 4px;
right: -4px;
width: 15px;
height: 15px;
border-radius: 50%;
font-style: normal;
font-weight: 700;
font-size: 9px;
line-height: 11px;
color: $white-500;
background: $blue-500;
}
}
} }
&__search-box { &__search-box {

View File

@ -24,10 +24,15 @@
<i class="sprite sprite-user-icon"></i> <i class="sprite sprite-user-icon"></i>
</a> </a>
<button class="user-items__minicart-button"> <div class="minicart">
<i class="sprite sprite-bag-icon"></i> <button class="minicart__button">
<vtex.cmc:AmountItemsInCart /> <i class="sprite sprite-bag-icon"></i>
</button> <vtex.cmc:AmountItemsInCart />
</button>
<div class="minicart__drawer"></div>
</div>
</div> </div>
</div> </div>
</div> </div>