Skip to content

Commit 309d942

Browse files
authored
Merge pull request #3 from coolguyzone/redux
Get addIngredient and removeIngredient working on all ingredient tabs
2 parents bf06543 + 03e8ab0 commit 309d942

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

Screens/IngredientsTabs/BeerAndWineTab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function BeerAndWineBoozeTab() {
77
<ScrollView>
88
<Text style={{ marginTop: 20 }}>Beer and Wine</Text>
99
<View style={styles.IngredientContainer}>
10-
{Constants.beerWine.map((drink) => {
11-
return <IngredientCheckBox key={drink}>{drink}</IngredientCheckBox>
10+
{Constants.beerWine.map((booze) => {
11+
return <IngredientCheckBox key={booze} ingredient={booze}>{booze}</IngredientCheckBox>
1212
})}
1313
</View>
1414
</ScrollView>

Screens/IngredientsTabs/DarkBoozeTab.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import CheckBox from "react-native-check-box";
44
import IngredientCheckBox from "../../components/IngredientCheckBox";
55
import { Constants } from "../../util/constants";
66

7+
78
function DarkBoozeTab() {
9+
810
return (
911
<ScrollView>
1012
<Text style={{ marginTop: 20 }}>Dark Booze</Text>
1113
<View style={styles.IngredientContainer}>
12-
{Constants.brownDrinks.map((drink) => {
13-
return <IngredientCheckBox key={drink}>{drink}</IngredientCheckBox>
14+
{Constants.brownBooze.map((booze) => {
15+
return <IngredientCheckBox key={booze} ingredient={booze}>{booze}</IngredientCheckBox>
1416
})}
1517
</View>
1618
</ScrollView>

Screens/IngredientsTabs/FruityBoozeTab.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ function FruityBoozeTab() {
77
<ScrollView>
88
<Text style={{ marginTop: 20 }}>Fruity Booze</Text>
99
<View style={styles.IngredientContainer}>
10-
{Constants.fruitDrinks.map((drink) => {
11-
return <IngredientCheckBox key={drink}>{drink}</IngredientCheckBox>
10+
{Constants.fruitBooze.map((booze) => {
11+
return (
12+
<IngredientCheckBox key={booze} ingredient={booze}>
13+
{booze}
14+
</IngredientCheckBox>
15+
);
1216
})}
1317
</View>
1418
</ScrollView>

Screens/IngredientsTabs/LightBoozeTab.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ function LightBoozeTab() {
2020
<ScrollView>
2121
<Text style={{ marginTop: 20 }}>Light Booze</Text>
2222
<View style={styles.IngredientContainer}>
23-
{Constants.clearBooze.map((drink) => {
23+
{Constants.clearBooze.map((booze) => {
2424
return (
25-
<IngredientCheckBox key={drink} booze={drink}>
26-
{drink}
25+
<IngredientCheckBox key={booze} ingredient={booze}>
26+
{booze}
2727
</IngredientCheckBox>
2828
);
2929
})}

Screens/IngredientsTabs/MixersTab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ function MixersTab() {
77
<ScrollView>
88
<Text style={{ marginTop: 20 }}>Mixers</Text>
99
<View style={styles.IngredientContainer}>
10-
{Constants.mixers.map((drink) => {
11-
return <IngredientCheckBox key={drink}>{drink}</IngredientCheckBox>
10+
{Constants.mixers.map((mixer) => {
11+
return <IngredientCheckBox key={mixer} ingredient={mixer}>{mixer}</IngredientCheckBox>
1212
})}
1313
</View>
1414
</ScrollView>

Screens/IngredientsTabs/ProduceTab.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ function ProduceTab() {
77
<ScrollView>
88
<Text style={{ marginTop: 20 }}>Produce</Text>
99
<View style={styles.IngredientContainer}>
10-
{Constants.produce.map((drink) => {
11-
return <IngredientCheckBox key={drink}>{drink}</IngredientCheckBox>
10+
{Constants.produce.map((produce) => {
11+
return (
12+
<IngredientCheckBox key={produce} ingredient={produce}>
13+
{produce}
14+
</IngredientCheckBox>
15+
);
1216
})}
1317
</View>
1418
</ScrollView>

components/IngredientCheckBox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ function IngredientCheckBox(props) {
1717
{
1818
if (CheckBoxState === true) {
1919
setCheckBoxState(false);
20-
dispatch(removeIngredient(props.booze));
20+
dispatch(removeIngredient(props.ingredient));
2121
} else {
2222
setCheckBoxState(true);
23-
dispatch(addIngredient(props.booze));
23+
dispatch(addIngredient(props.ingredient));
2424
}
2525
}
2626
}

util/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const Constants = {
2-
brownDrinks: [
2+
brownBooze: [
33
"Bourbon",
44
"Scotch",
55
"Coffee Liqueur",
@@ -47,7 +47,7 @@ export const Constants = {
4747
"Cranberry Vodka",
4848
"Vanilla Vodka",
4949
],
50-
fruitDrinks: [
50+
fruitBooze: [
5151
"Absinthe",
5252
"Irish Cream",
5353
"Triple Sec",

0 commit comments

Comments
 (0)