From 2466cf65190e666f1aaf6fa699e63fb6c2cf6fcf Mon Sep 17 00:00:00 2001 From: Sebas Vallejo Date: Thu, 21 Aug 2025 20:16:00 -0500 Subject: [PATCH 1/2] feat: update product variant UI --- .../components/product-card/index.tsx | 13 +- src/routes/checkout/index.tsx | 123 +++++++++++------- src/routes/product/index.tsx | 59 ++++++++- 3 files changed, 139 insertions(+), 56 deletions(-) diff --git a/src/routes/category/components/product-card/index.tsx b/src/routes/category/components/product-card/index.tsx index a6abe33..c4130e6 100644 --- a/src/routes/category/components/product-card/index.tsx +++ b/src/routes/category/components/product-card/index.tsx @@ -1,5 +1,4 @@ import { Link } from "react-router"; - import type { Product } from "@/models/product.model"; interface ProductCardProps { @@ -7,6 +6,8 @@ interface ProductCardProps { } export function ProductCard({ product }: ProductCardProps) { + const isSticker = product.categoryId === 3; + return (

{product.title}

{product.description}

-

S/{product.price}

+ {isSticker && ( +
+

Entre

+

2.59 - 5.30

+
+ )} + {!isSticker && ( +

S/{product.price}

+ )} {product.isOnSale && ( diff --git a/src/routes/checkout/index.tsx b/src/routes/checkout/index.tsx index 1ceb7ae..5bfbbde 100644 --- a/src/routes/checkout/index.tsx +++ b/src/routes/checkout/index.tsx @@ -301,56 +301,79 @@ export default function Checkout({ Información de envío
- - - - {errors.company?.message &&

{errors.company?.message}

} - - - - - +
+
+ +
+
+ +
+
+ + + {errors.company?.message &&

{errors.company?.message}

} + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ ("Medium"); if (!product) { return ; } + const showSizeSelector = product.categoryId === 1 || product.categoryId === 3; + + const getSizeOptions = () => { + if (product.categoryId === 3) { + return { + label: "Dimensiones", + options: [ + { value: "Small", label: "3x3 cm" }, + { value: "Medium", label: "5x5 cm" }, + { value: "Large", label: "10x10 cm" } + ] + }; + } else { + return { + label: "Talla", + options: [ + { value: "Small", label: "Small" }, + { value: "Medium", label: "Medium" }, + { value: "Large", label: "Large" } + ] + }; + } + }; + + const sizeOptions = getSizeOptions(); + return ( <>
@@ -40,11 +65,35 @@ export default function Product({ loaderData }: Route.ComponentProps) {

{product.title} + {showSizeSelector && ( + + {" "}({sizeOptions.options.find(option => option.value === selectedSize)?.label}) + + )}

S/{product.price}

{product.description}

+ + {showSizeSelector && ( +
+

{sizeOptions.label}

+
+ {sizeOptions.options.map((option) => ( + + ))} +
+
+ )} +
+ +

Características @@ -78,4 +129,4 @@ export default function Product({ loaderData }: Route.ComponentProps) {

); -} +} \ No newline at end of file From f448d4b22da92ac1dc92f236fc6b1ba11243ea25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Vallejo?= Date: Fri, 22 Aug 2025 20:11:01 -0500 Subject: [PATCH 2/2] Refactor: sticker UI update --- src/routes/category/components/product-card/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/category/components/product-card/index.tsx b/src/routes/category/components/product-card/index.tsx index c4130e6..2265f4f 100644 --- a/src/routes/category/components/product-card/index.tsx +++ b/src/routes/category/components/product-card/index.tsx @@ -28,8 +28,8 @@ export function ProductCard({ product }: ProductCardProps) {

{product.description}

{isSticker && (
-

Entre

-

2.59 - 5.30

+

Desde

+

S/2.59

)} {!isSticker && (