From 4773102af221fc38342869c4ba0b571e02f4400e Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Wed, 16 Oct 2024 16:29:23 +0530 Subject: Add CartItem component to display individual items in the cart with quantity adjustment --- src/components/CartItem.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/components/CartItem.js b/src/components/CartItem.js index e69de29..da56fbc 100644 --- a/src/components/CartItem.js +++ b/src/components/CartItem.js @@ -0,0 +1,26 @@ +import React from 'react'; +import { View, Text, Button, StyleSheet } from 'react-native'; +import QuantityAdjuster from './QuantityAdjuster'; + +const CartItem = ({ item, onUpdateQuantity }) => ( + + {item.name} + ${item.price.toFixed(2)} + onUpdateQuantity(item.id, newQuantity)} /> + +); + +const styles = StyleSheet.create({ + container: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + padding: 10, + borderBottomWidth: 1, + borderColor: '#ccc' + }, + name: { fontSize: 18 }, + price: { fontSize: 16, color: '#888' }, +}); + +export default CartItem; -- cgit v1.2.3-59-g8ed1b