feat: Adicioa minicart

This commit is contained in:
Saulo Klein Nery 2022-12-08 14:38:47 -03:00
parent 2d00732b68
commit 85c28ba5f0
5 changed files with 74 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, {
elemento: ".news-form",
textButtom: "Cadastre-se",

View File

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

View File

@ -1,10 +1,53 @@
.mini-cart {
.minicart {
position: relative;
&__button {
position: relative;
padding: 0;
border: 0;
outline: 0;
background-color: 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;
color: $white-500;
background-color: $blue-500;
}
}
&__drawer {
height: 475px;
max-height: 200px;
opacity: 0;
position: absolute;
right: 0px;
top: 50px;
top: 80px;
transition: all 0.3s ease-in-out;
visibility: hidden;
width: 375px;
@ -17,6 +60,7 @@
position: fixed;
top: 0;
}
}
}
.show-mini-cart {
@ -380,7 +424,7 @@
}
.finish-order {
background-color: $color-green;
background-color: $black-500;
color: $color-white;
display: block;
font-weight: 700;
@ -392,11 +436,11 @@
width: 100%;
&:hover {
background-color: lighten($color-green, 2.5);
background-color: lighten($black-500, 2.5);
}
&:active {
background-color: darken($color-green, 10);
background-color: darken($black-500, 10);
}
}
}

View File

@ -68,45 +68,6 @@
}
}
}
&__minicart-button {
position: relative;
padding: 0;
border: 0;
outline: 0;
background-color: 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;
color: $white-500;
background-color: $blue-500;
}
}
}
&__search-box {

View File

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