From 4885d39284ddd53d578cc87b93c136a025e3b577 Mon Sep 17 00:00:00 2001 From: ncoronel Date: Tue, 7 Jul 2026 16:37:06 -0300 Subject: [PATCH] feat(cart): enhance cart item layout and styles for improved design consistency --- .../store-layout/store-layout.component.scss | 1 - .../cart-item/cart-item.component.html | 6 +-- .../cart-item/cart-item.component.scss | 48 ++++++++++++------- .../components/cart/cart.component.html | 5 +- .../components/cart/cart.component.scss | 8 +++- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/app/core/layout/store-layout/store-layout.component.scss b/src/app/core/layout/store-layout/store-layout.component.scss index d21917b..272ca6d 100644 --- a/src/app/core/layout/store-layout/store-layout.component.scss +++ b/src/app/core/layout/store-layout/store-layout.component.scss @@ -24,7 +24,6 @@ top: 76px; right: calc((100% - 1320px) / 2 + 1.5rem); - height: 520px; max-height: calc(100vh - 120px); z-index: 1050; background-color: #ffffff; diff --git a/src/app/shared/components/cart-item/cart-item.component.html b/src/app/shared/components/cart-item/cart-item.component.html index 583c1f0..e33ff77 100644 --- a/src/app/shared/components/cart-item/cart-item.component.html +++ b/src/app/shared/components/cart-item/cart-item.component.html @@ -1,4 +1,4 @@ -
+
@if (discountPercentage() && discountPercentage()! > 0) { -{{ discountPercentage() }}% @@ -17,10 +17,10 @@
@if (formattedOriginalPrice(); as originalPrice) { - {{ originalPrice }} + {{ originalPrice }} } - {{ formattedDiscountedPrice() }} + {{ formattedDiscountedPrice() }}
diff --git a/src/app/shared/components/cart-item/cart-item.component.scss b/src/app/shared/components/cart-item/cart-item.component.scss index 6e9bdd9..4c7b4f2 100644 --- a/src/app/shared/components/cart-item/cart-item.component.scss +++ b/src/app/shared/components/cart-item/cart-item.component.scss @@ -1,28 +1,43 @@ :host { display: block; - --item-media-width: 64px; - --item-media-height: 72px; + --item-media-size: 90px; + --item-divider-inset: 1rem; } -@media (max-width: 420px) { - :host { - --item-media-width: 56px; - --item-media-height: 64px; - } +:host(:first-child) .cart-item, +:host .cart-item { + position: relative; +} + +: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 { 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; - padding: 10px 12px; background-color: #f5f5f5; } .cart-item-media { - width: var(--item-media-width); - height: var(--item-media-height); - border-radius: 6px; + width: var(--item-media-size); + aspect-ratio: 1 / 1; + border-radius: 5px 0 0 5px; background-color: #ffffff; border: 1px solid #eaeaea; overflow: hidden; @@ -30,14 +45,14 @@ img { width: 100%; height: 100%; - object-fit: contain; + object-fit: cover; } } .cart-item-discount-badge { padding: 2px 5px; border-bottom-right-radius: 4px; - background-color: #6173ff; + background-color: var(--bs-primary); color: #ffffff; font-size: 8px; font-weight: 500; @@ -45,6 +60,8 @@ } .cart-item-placeholder { + width: 100%; + height: 100%; background: linear-gradient(135deg, #d2d2d2, #ececec); } @@ -100,9 +117,6 @@ gap: 0.125rem; } - - - .cart-item-remove-btn { margin-left: 0.35rem; } diff --git a/src/app/shared/components/cart/cart.component.html b/src/app/shared/components/cart/cart.component.html index 234cde6..604eb4f 100644 --- a/src/app/shared/components/cart/cart.component.html +++ b/src/app/shared/components/cart/cart.component.html @@ -1,5 +1,5 @@
-
+

{{ title() }}

@if (showClose()) { @@ -9,7 +9,7 @@ }
-
+
@for (item of items(); track item.productVariantId || item.product + item.discountedPrice; let idx = $index) { + diff --git a/src/app/shared/components/cart/cart.component.scss b/src/app/shared/components/cart/cart.component.scss index 2bb4027..e3231cb 100644 --- a/src/app/shared/components/cart/cart.component.scss +++ b/src/app/shared/components/cart/cart.component.scss @@ -23,10 +23,16 @@ .cart-items-container { min-height: 0; - padding: 0 0 0 24px; + gap: 0; scrollbar-color: #d5d5d5 transparent; scrollbar-width: thin; + app-cart-item { + display: block; + } + + + &::-webkit-scrollbar { width: 6px; }