Skip to content

Commit 5e13493

Browse files
committed
Able to modify quantity in cart, but currently will not update remotely yet
1 parent c83c088 commit 5e13493

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

components/Cart/CartPage/CartItem.component.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ const CartItem = ({ item, products, handleRemoveProductClick }) => {
3030
</td>
3131

3232
<td className="px-4 py-2 border">
33-
<input className="w-12" type="number" min="1" value={productCount} />
33+
<input
34+
className="w-12"
35+
type="number"
36+
min="1"
37+
defaultValue={productCount}
38+
onChange={() => {
39+
console.log('Changed quantity ...');
40+
}}
41+
/>
3442
</td>
3543

3644
<td className="px-4 py-2 border">

components/Cart/CartPage/MobileCartItem.component.jsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@ const MobileCartItem = ({ item }) => {
1111
<SVGX />
1212
</div>
1313

14-
<div className="inline-block pt-2">
15-
{item.name}
16-
17-
</div>
14+
<div className="inline-block pt-2">{item.name}</div>
1815

1916
<div className="inline-block pt-2">
2017
{'string' !== typeof item.price ? item.price.toFixed(2) : item.price}
21-
2218
</div>
2319

2420
<div className="inline-block pt-2">
25-
<input className="w-12" type="number" min="1" value={productCount} />
26-
21+
<input
22+
className="w-12"
23+
type="number"
24+
min="1"
25+
defaultValue={productCount}
26+
onChange={() => {
27+
console.log('Changed quantity ...');
28+
}}
29+
/>
2730
</div>
2831

2932
<div className="inline-block pt-2">
3033
{'string' !== typeof item.totalPrice
3134
? item.totalPrice.toFixed(2)
3235
: item.totalPrice}
33-
3436
</div>
3537
</>
3638
);

0 commit comments

Comments
 (0)