-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGoalsPage.js
130 lines (115 loc) · 2.74 KB
/
GoalsPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import React, { useState } from 'react';
import GoalBar from "./GoalBar.js";
import Goal from "./Goal.js";
import { StyleSheet, Text, View, TextInput, TouchableOpacity, Button, ScrollView, Modal} from 'react-native';
// import SwipeableViews from 'react-swipeable-views';
const GoalsPage = ({goHome, goalList, setGoalList, removeGoal}) =>{
const [enteredGoal, setEnteredGoal] = useState('')
const goalInput = (goal) => {
setEnteredGoal(goal)
}
const addGoal = () => {
setGoalList((curr) => [...curr, enteredGoal])
}
return (
<View style={{backgroundColor: "#E8DAEF"}}>
<TouchableOpacity activeOpacity={0.5} style = {styles.homebutton} onPress={() => goHome('Home')}>
<Text style = {styles.homebuttontext}> Home </Text>
</TouchableOpacity>
<View style = {styles.container}>
<GoalBar goalInput = {goalInput} enteredGoal = {enteredGoal} />
<View style={styles.buttonView}>
<Button
title="Add Goal!"
color="#17202A"
onPress={addGoal}
/>
</View>
<ScrollView style={styles.scroll}>
{goalList.map((goal) =>
<Goal key={goal} text={goal} removeGoal={() => removeGoal(goal)} />
)}
</ScrollView>
</View>
</View>
);
}
export default GoalsPage;
const styles = StyleSheet.create({
container: {
marginTop:0,
alignItems:"center",
height:"100%",
width:"100%",
},
goalinput: {
marginTop:130,
fontSize:25,
borderWidth:1,
width:"90%",
height:80,
borderRadius:10,
borderWidth: 2,
backgroundColor: "#D6EAF8"
},
buttonView: {
margin: 6,
backgroundColor: "#58D68D",
borderWidth: 2,
borderRadius: 10,
},
homebutton: {
alignItems: 'flex-start',
marginTop: 50,
marginLeft: 20,
width: "20%",
height: "5%",
borderRadius: 10,
backgroundColor: "#E74C3C",
},
homebuttontext: {
fontSize:20,
marginLeft: 10,
marginTop: 10,
color: "white",
fontWeight: "700"
},
goalInfoModal: {
marginTop: 75,
alignSelf: 'center',
width:"80%",
backgroundColor:"white",
height: "80%",
borderRadius:10,
},
exitModalButton: {
width:30,
height:30,
borderRadius:20,
backgroundColor: "#D6DBDF",
alignSelf: "flex-start",
marginTop: 10,
marginLeft: 10,
justifyContent: "center",
alignItems: "center"
},
xButton: {
color: "#5D6D7E",
fontSize:20,
fontWeight: "bold",
},
removeGoalButton: {
marginTop:610,
backgroundColor: "#E74C3C",
height: 40,
width: 100,
justifyContent: "center",
alignItems: "center",
borderRadius: 10,
alignSelf:"center",
},
removeGoalText: {
color:"white",
fontWeight:"bold"
}
});