From 77e4a2274021cf7e4639f15c7c47c937b841969a Mon Sep 17 00:00:00 2001 From: ncoronel Date: Mon, 29 Jun 2026 08:37:15 -0300 Subject: [PATCH] feat: add ProductCard component with currency formatting and price calculation logic --- .../product-card/product-card.component.html | 24 +++++++++---------- .../product-card/product-card.component.scss | 12 +++++----- .../product-card/product-card.component.ts | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/app/shared/components/product-card/product-card.component.html b/src/app/shared/components/product-card/product-card.component.html index 837e4a3..58fefac 100644 --- a/src/app/shared/components/product-card/product-card.component.html +++ b/src/app/shared/components/product-card/product-card.component.html @@ -2,34 +2,35 @@
@if (imageUrl()) { - + } @else { -
- -
+
+ +
} @if (discount() && discount()! > 0) { - - -{{ discount() }}% - + + -{{ discount() }}% + }
-

{{ title() }}

+

{{ title() }}

-
+
{{ formattedDiscountedPrice() }} @if (discount() && discount()! > 0) { - {{ formattedOriginalPrice() }} + {{ formattedOriginalPrice() }} }
@@ -46,5 +47,4 @@
- - + \ No newline at end of file diff --git a/src/app/shared/components/product-card/product-card.component.scss b/src/app/shared/components/product-card/product-card.component.scss index 6219253..a9d809c 100644 --- a/src/app/shared/components/product-card/product-card.component.scss +++ b/src/app/shared/components/product-card/product-card.component.scss @@ -6,7 +6,7 @@ .product-card { width: 100%; - height: 100%; + max-height: 411px; transition: transform 0.2s ease, box-shadow 0.2s ease; &:hover { @@ -16,6 +16,7 @@ &__image-container { width: 100%; + max-height: 50%; aspect-ratio: 1 / 1; overflow: hidden; } @@ -37,7 +38,7 @@ &__price-discounted { color: var(--tenant-primary) !important; font-size: 24px; - font-weight: 425; + font-weight: 700; } @@ -53,7 +54,7 @@ } &__price-transfer-value { - font-weight: 400; + font-weight: 700; } &__price-transfer-label { @@ -64,7 +65,7 @@ app-button { display: block; width: 100%; - + ::ng-deep .btn { width: 100%; min-width: 100%; @@ -72,5 +73,4 @@ } } } -} - +} \ No newline at end of file diff --git a/src/app/shared/components/product-card/product-card.component.ts b/src/app/shared/components/product-card/product-card.component.ts index 33976c4..8459ca0 100644 --- a/src/app/shared/components/product-card/product-card.component.ts +++ b/src/app/shared/components/product-card/product-card.component.ts @@ -64,6 +64,6 @@ export class ProductCardComponent { const rounded = Math.round(value); const parts = rounded.toString().split('.'); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, '.'); - return `$ ${parts.join(',')}`; + return `$${parts.join(',')}`; } }