aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-10-16 16:29:33 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-10-16 16:29:33 +0530
commita1c3c7a193ac4593d7ddef81b08945b12083cc6a (patch)
tree09f537abaedf11a591a06aefa0369e490086eb3a /src
parentff21a7ff19d0eb67016c1a3b297aa227c315c910 (diff)
downloadmall-app-a1c3c7a193ac4593d7ddef81b08945b12083cc6a.tar.gz
mall-app-a1c3c7a193ac4593d7ddef81b08945b12083cc6a.tar.bz2
mall-app-a1c3c7a193ac4593d7ddef81b08945b12083cc6a.zip
Add QuantityAdjuster component for adjusting item quantity in the cart
Diffstat (limited to 'src')
-rw-r--r--src/components/QuantityAdjuster.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/components/QuantityAdjuster.js b/src/components/QuantityAdjuster.js
index e69de29..273e409 100644
--- a/src/components/QuantityAdjuster.js
+++ b/src/components/QuantityAdjuster.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { View, Button, Text, StyleSheet } from 'react-native';
+
+const QuantityAdjuster = ({ quantity, onChange }) => (
+ <View style={styles.container}>
+ <Button title="-" onPress={() => onChange(quantity > 1 ? quantity - 1 : 1)} />
+ <Text style={styles.quantity}>{quantity}</Text>
+ <Button title="+" onPress={() => onChange(quantity + 1)} />
+ </View>
+);
+
+const styles = StyleSheet.create({
+ container: {
+ flexDirection: 'row',
+ alignItems: 'center',
+ },
+ quantity: {
+ marginHorizontal: 10,
+ fontSize: 18,
+ },
+});
+
+export default QuantityAdjuster;