@@ -30,65 +30,71 @@ export default function Cart({ loaderData }: Route.ComponentProps) {
3030 Carrito de compras
3131 </ h1 >
3232 < div className = "border-solid border rounded-xl flex flex-col" >
33- { cart ?. items ?. map ( ( { product, quantity, id, variantAttributeValue
34- } ) => (
35- < div key = { variantAttributeValue ?. id } className = "flex gap-7 p-6 border-b" >
36- < div className = "w-20 rounded-xl bg-muted" >
37- < img
38- src = { product . imgSrc }
39- alt = { product . alt || product . title }
40- className = "w-full aspect-[2/3] object-contain"
41- />
42- </ div >
43- < div className = "flex grow flex-col justify-between" >
44- < div className = "flex gap-4 justify-between items-center" >
45- < h2 className = "text-sm" > { product . title } ({ variantAttributeValue ?. value } )</ h2 >
46- < Form method = "post" action = "/cart/remove-item" >
47- < Button
48- size = "sm-icon"
49- variant = "outline"
50- name = "itemId"
51- value = { id }
52- >
53- < Trash2 />
54- </ Button >
55- </ Form >
33+ { cart ?. items ?. map (
34+ ( { product, quantity, id, variantAttributeValue } ) => (
35+ < div
36+ key = { variantAttributeValue ?. id }
37+ className = "flex gap-7 p-6 border-b"
38+ >
39+ < div className = "w-20 rounded-xl bg-muted" >
40+ < img
41+ src = { product . imgSrc }
42+ alt = { product . alt || product . title }
43+ className = "w-full aspect-[2/3] object-contain"
44+ />
5645 </ div >
57- < div className = "flex flex-col gap-2 md:flex-row md:justify-between md:items-center" >
58- < p className = "text-sm font-medium" >
59- ${ product . price ! . toFixed ( 2 ) }
60- </ p >
61- < div className = "flex gap-4 items-center" >
62- < Form method = "post" action = "/cart/add-item" >
63- < input type = "hidden" name = "quantity" value = "-1" />
46+ < div className = "flex grow flex-col justify-between" >
47+ < div className = "flex gap-4 justify-between items-center" >
48+ < h2 className = "text-sm" >
49+ { product . title } ({ variantAttributeValue ?. value } )
50+ </ h2 >
51+ < Form method = "post" action = "/cart/remove-item" >
6452 < Button
65- name = "attributeValueId"
66- value = { variantAttributeValue ?. id }
67- variant = "outline"
6853 size = "sm-icon"
69- disabled = { quantity === 1 }
70- >
71- < Minus />
72- </ Button >
73- </ Form >
74- < span className = "h-8 w-8 flex justify-center items-center border rounded-md py-2 px-4" >
75- { quantity }
76- </ span >
77- < Form method = "post" action = "/cart/add-item" >
78- < Button
7954 variant = "outline"
80- size = "sm-icon"
81- name = "attributeValueId"
82- value = { variantAttributeValue ?. id }
55+ name = "itemId"
56+ value = { id }
8357 >
84- < Plus />
58+ < Trash2 />
8559 </ Button >
8660 </ Form >
8761 </ div >
62+ < div className = "flex flex-col gap-2 md:flex-row md:justify-between md:items-center" >
63+ < p className = "text-sm font-medium" >
64+ ${ product . price ! . toFixed ( 2 ) }
65+ </ p >
66+ < div className = "flex gap-4 items-center" >
67+ < Form method = "post" action = "/cart/add-item" >
68+ < input type = "hidden" name = "quantity" value = "-1" />
69+ < Button
70+ name = "attributeValueId"
71+ value = { variantAttributeValue ?. id }
72+ variant = "outline"
73+ size = "sm-icon"
74+ disabled = { quantity === 1 }
75+ >
76+ < Minus />
77+ </ Button >
78+ </ Form >
79+ < span className = "h-8 w-8 flex justify-center items-center border rounded-md py-2 px-4" >
80+ { quantity }
81+ </ span >
82+ < Form method = "post" action = "/cart/add-item" >
83+ < Button
84+ variant = "outline"
85+ size = "sm-icon"
86+ name = "attributeValueId"
87+ value = { variantAttributeValue ?. id }
88+ >
89+ < Plus />
90+ </ Button >
91+ </ Form >
92+ </ div >
93+ </ div >
8894 </ div >
8995 </ div >
90- </ div >
91- ) ) }
96+ )
97+ ) }
9298 < div className = "flex justify-between p-6 text-base font-medium border-b" >
9399 < p > Total</ p >
94100 < p > S/{ total . toFixed ( 2 ) } </ p >
@@ -107,3 +113,4 @@ export default function Cart({ loaderData }: Route.ComponentProps) {
107113 </ Section >
108114 ) ;
109115}
116+
0 commit comments