🔥 Finish Cart implementation

- Use Select component in CartItem to change quantity
- Visual update when removing or changing an item quantity
- API: Remove Cart item action
- API: Handle Cart item adding and updating (quantity)
This commit is contained in:
2021-11-07 20:21:20 +01:00
parent e1c259164f
commit f7457b5f8d
8 changed files with 290 additions and 105 deletions

View File

@@ -1,12 +1,13 @@
.cart {
display: flex;
flex-direction: column;
overflow: hidden;
padding: 20px 20px 24px;
background-color: $color-cream;
border-radius: 8px;
padding: 20px 20px 24px;
@include bp (sm) {
padding: 24px 32px;
padding: 24px 32px 32px;
}
// Heading
@@ -51,21 +52,10 @@
// Content
&__content {
position: relative;
flex: 1;
}
// Message
&__message {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 24px;
background: #fff;
color: $color-gray;
border-radius: 6px;
}
// Total
&__total {
margin-top: auto;
@@ -73,7 +63,7 @@
color: $color-gray;
@include bp (md) {
margin: 32px 0;
margin: 32px 0 0;
}
// Sum
@@ -138,6 +128,67 @@
}
}
// Empty content
&__empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
padding: 24px;
font-size: rem(20px);
font-weight: 200;
background: #fff;
color: $color-gray;
border-radius: 6px;
// Icon
.icon {
display: flex;
align-items: center;
justify-content: center;
width: 64px;
height: 64px;
margin-bottom: 16px;
color: #FF6C89;
background: $color-cream;
border-radius: 100%;
}
}
// Updating message
&__update {
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: rem(20px);
color: $color-secondary;
transition: opacity 0.6s var(--ease-quart), transform 0.6s var(--ease-quart);
opacity: 0;
transform: translate3d(0, -8px, 0);
}
// Updating state
&.is-updating {
.cart-item {
opacity: 0.1;
pointer-events: none;
user-select: none;
}
.cart__update {
opacity: 1;
transform: translate3d(0,0,0);
}
}
// Overlay
&-overlay {
position: fixed;