feat(cart): enhance cart item layout and styles for improved design consistency

This commit is contained in:
2026-07-07 16:37:06 -03:00
parent 9d42de9fa8
commit 4885d39284
5 changed files with 44 additions and 24 deletions

View File

@@ -24,7 +24,6 @@
top: 76px; top: 76px;
right: calc((100% - 1320px) / 2 + 1.5rem); right: calc((100% - 1320px) / 2 + 1.5rem);
height: 520px;
max-height: calc(100vh - 120px); max-height: calc(100vh - 120px);
z-index: 1050; z-index: 1050;
background-color: #ffffff; background-color: #ffffff;

View File

@@ -1,4 +1,4 @@
<article class="w-100 rounded-0 cart-item"> <article class="w-100 p-3 rounded-0 cart-item">
<div class="position-relative overflow-hidden cart-item-media"> <div class="position-relative overflow-hidden cart-item-media">
@if (discountPercentage() && discountPercentage()! > 0) { @if (discountPercentage() && discountPercentage()! > 0) {
<span class="position-absolute top-0 start-0 z-1 rounded-0 cart-item-discount-badge">-{{ discountPercentage() }}%</span> <span class="position-absolute top-0 start-0 z-1 rounded-0 cart-item-discount-badge">-{{ discountPercentage() }}%</span>
@@ -17,10 +17,10 @@
<div class="text-nowrap cart-item-prices"> <div class="text-nowrap cart-item-prices">
@if (formattedOriginalPrice(); as originalPrice) { @if (formattedOriginalPrice(); as originalPrice) {
<span class="text-decoration-line-through fw-light cart-item-original-price">{{ originalPrice }}</span> <span class="text-decoration-line-through mb-1 fw-light cart-item-original-price">{{ originalPrice }}</span>
} }
<span class="fw-normal cart-item-discounted-price">{{ formattedDiscountedPrice() }}</span> <span class="fw-bold cart-item-discounted-price">{{ formattedDiscountedPrice() }}</span>
</div> </div>
</div> </div>

View File

@@ -1,28 +1,43 @@
:host { :host {
display: block; display: block;
--item-media-width: 64px; --item-media-size: 90px;
--item-media-height: 72px; --item-divider-inset: 1rem;
} }
@media (max-width: 420px) { :host(:first-child) .cart-item,
:host { :host .cart-item {
--item-media-width: 56px; position: relative;
--item-media-height: 64px; }
}
:host(:first-child) .cart-item::before,
:host .cart-item::after {
content: "";
position: absolute;
right: var(--item-divider-inset);
left: var(--item-divider-inset);
height: 1px;
background-color: #ffffff;
}
:host(:first-child) .cart-item::before {
top: 0;
}
:host .cart-item::after {
bottom: 0;
} }
.cart-item { .cart-item {
display: grid; display: grid;
grid-template-columns: var(--item-media-width) minmax(0, 1fr); grid-template-columns: var(--item-media-size) minmax(0, 1fr);
gap: 0.75rem; gap: 0.75rem;
padding: 10px 12px;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.cart-item-media { .cart-item-media {
width: var(--item-media-width); width: var(--item-media-size);
height: var(--item-media-height); aspect-ratio: 1 / 1;
border-radius: 6px; border-radius: 5px 0 0 5px;
background-color: #ffffff; background-color: #ffffff;
border: 1px solid #eaeaea; border: 1px solid #eaeaea;
overflow: hidden; overflow: hidden;
@@ -30,14 +45,14 @@
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: contain; object-fit: cover;
} }
} }
.cart-item-discount-badge { .cart-item-discount-badge {
padding: 2px 5px; padding: 2px 5px;
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
background-color: #6173ff; background-color: var(--bs-primary);
color: #ffffff; color: #ffffff;
font-size: 8px; font-size: 8px;
font-weight: 500; font-weight: 500;
@@ -45,6 +60,8 @@
} }
.cart-item-placeholder { .cart-item-placeholder {
width: 100%;
height: 100%;
background: linear-gradient(135deg, #d2d2d2, #ececec); background: linear-gradient(135deg, #d2d2d2, #ececec);
} }
@@ -100,9 +117,6 @@
gap: 0.125rem; gap: 0.125rem;
} }
.cart-item-remove-btn { .cart-item-remove-btn {
margin-left: 0.35rem; margin-left: 0.35rem;
} }

View File

@@ -1,5 +1,5 @@
<section class="d-flex flex-column h-100 overflow-hidden text-secondary" [style.background-color]="backgroundColor()"> <section class="d-flex flex-column h-100 overflow-hidden text-secondary" [style.background-color]="backgroundColor()">
<header class="d-flex align-items-center justify-content-between bg-transparent cart-header"> <header class="d-flex align-items-center p-3 justify-content-between bg-transparent cart-header">
<h2 class="m-0 text-uppercase fw-bold cart-title">{{ title() }}</h2> <h2 class="m-0 text-uppercase fw-bold cart-title">{{ title() }}</h2>
@if (showClose()) { @if (showClose()) {
@@ -9,7 +9,7 @@
} }
</header> </header>
<div class="d-grid gap-2 flex-grow-1 overflow-y-auto cart-items-container"> <div class="d-grid w-100 flex-grow-1 overflow-y-auto cart-items-container">
@for (item of items(); track item.productVariantId || item.product + item.discountedPrice; let idx = $index) { @for (item of items(); track item.productVariantId || item.product + item.discountedPrice; let idx = $index) {
<app-cart-item <app-cart-item
[imageUrl]="item.imageUrl" [imageUrl]="item.imageUrl"
@@ -48,3 +48,4 @@
</section> </section>

View File

@@ -23,10 +23,16 @@
.cart-items-container { .cart-items-container {
min-height: 0; min-height: 0;
padding: 0 0 0 24px; gap: 0;
scrollbar-color: #d5d5d5 transparent; scrollbar-color: #d5d5d5 transparent;
scrollbar-width: thin; scrollbar-width: thin;
app-cart-item {
display: block;
}
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 6px; width: 6px;
} }