1- import React , { useEffect } from "react" ;
1+ import React , { useState , useEffect } from "react" ;
22import {
33 View ,
44 StyleSheet ,
55 Text ,
66 TouchableOpacity ,
77 AntDesign ,
88} from "react-native" ;
9+ import { connect } from "react-redux" ;
910import Colors from "../../constants/Colors" ;
1011import { ScrollView } from "react-native-gesture-handler" ;
12+ import { getColors } from "../reusable/getColors" ;
1113
12- const DiningMenu = props => {
14+ const mapStateToProps = ( state ) => {
15+ return {
16+ darkmode : state . settings . darkmode
17+ } ;
18+ } ;
19+
20+ const DiningMenu = ( props ) => {
21+ const Colors = getColors ( props . darkmode ) ;
22+ const styles = getStyles ( Colors ) ;
23+ const [ starred , setStarred ] = useState ( props . isStarred ? true : false ) ;
24+ const [ starName , setStarName ] = useState ( starred ? "star" : "staro" ) ;
25+ const [ starColor , setStarColor ] = useState (
26+ starred ? Colors . starYellow : Colors . inactiveIcon
27+ ) ;
1328 console . log ( props . route . params ) ;
29+
30+ const hoursHandler = ( ) => {
31+ let signStyle = styles . open ;
32+ let timeStyle = styles . closed ;
33+ let text1 = "Open" ;
34+ let text2 = "7:00 AM - 7:30 PM"
35+ return (
36+ < View style = { styles . info } >
37+ < Text style = { [ signStyle , styles . sign ] } > { text1 } </ Text >
38+ < Text style = { styles . text } > { text2 } </ Text >
39+ </ View >
40+ ) ;
41+ }
1442
1543 return (
16- < Text > Hi</ Text >
17- // <View style={styles.screen}>
18- // <View style={styles.header}>
19- // <Text style={styles.title}>Dining Menu</Text>
20- // <TouchableOpacity style={styles.starArea} onPress={starHandler}>
21- // <AntDesign
22- // style={styles.star}
23- // name={starName}
24- // size={30}
25- // color={starColor}
26- // />
27- // </TouchableOpacity>
28- // </View>
29- // <View style={styles.openHours}></View>
30- // <Text>Entrees</Text>
31- // <View style={styles.horizontalLine} />
32- // </View>
44+
45+ < View style = { styles . screen } >
46+ < View style = { styles . header } >
47+ < Text style = { styles . title } > { props . children } Sharpe Refrectory</ Text >
48+ { /* <TouchableOpacity>
49+ <AntDesign
50+ style={styles.star}
51+ name={starName}
52+ size={30}
53+ color={starColor}
54+ />
55+ </TouchableOpacity> */ }
56+ </ View >
57+ < View >
58+ { hoursHandler ( ) }
59+ </ View >
60+ < View style = { styles . mealInfo } >
61+ < Text style = { styles . text } > Now Serving</ Text >
62+ < Text style = { [ styles . text , styles . mealStatus ] } > Breakfast</ Text >
63+ </ View >
64+ < Text style = { styles . menuTitle } > Entrees</ Text >
65+ < View style = { styles . horizontalLine } />
66+ < Text style = { styles . menuTitle } > Fresh Fruits</ Text >
67+ < View style = { styles . horizontalLine } />
68+ < Text style = { styles . menuTitle } > Desserts</ Text >
69+ < View style = { styles . horizontalLine } />
70+ </ View >
3371 ) ;
3472} ;
3573
@@ -41,34 +79,52 @@ const DiningMenu = props => {
4179// fetchMenu();
4280// }, []);
4381
44- const styles = StyleSheet . create ( {
82+ const getStyles = ( Colors ) => StyleSheet . create ( {
4583 screen : {
4684 flex : 1 ,
4785 padding : 10 ,
4886 alignItems : "center" ,
4987 backgroundColor : "#fafafa" ,
5088 } ,
5189 header : {
90+ height : 110 ,
91+ backgroundColor : "#f9f9f9" ,
92+ elevation : 0 ,
93+ shadowOpacity : 0 ,
5294 flexDirection : "row" ,
5395 justifyContent : "space-between" ,
96+ alignItems : "center" ,
97+ paddingLeft : 20 ,
98+ paddingRight : 26 ,
5499 } ,
55100 title : {
56- fontWeight : "600" ,
57- fontSize : 28 ,
101+ color : "#000000" ,
102+ paddingLeft : 12 ,
103+ fontSize : 32 ,
58104 } ,
59105 starArea : {
60106 height : 32 ,
61107 } ,
108+ menuTitle : {
109+ color : "#000000" ,
110+ fontSize : 18 ,
111+ } ,
62112 horizontalLine : {
63113 marginBottom : 18 ,
64114 alignSelf : "center" ,
65115 width : "86%" ,
66116 borderBottomColor : "#D3D3D3" ,
67117 borderBottomWidth : 1 ,
68118 } ,
69- openHours : {
119+ info : {
70120 flexDirection : "row" ,
71121 justifyContent : "space-between" ,
122+ marginTop : 10 ,
123+ paddingBottom : 10 ,
124+ } ,
125+ openHours : {
126+ flexDirection : "row" ,
127+ justifyContent : "space-between" ,
72128 } ,
73129 open : {
74130 color : Colors . success ,
@@ -88,6 +144,21 @@ const styles = StyleSheet.create({
88144 paddingBottom : 1 ,
89145 fontWeight : "600" ,
90146 } ,
147+ mealInfo : {
148+ alignItems : "center" ,
149+ paddingBottom : 10 ,
150+ } ,
151+ mealStatus : {
152+ fontWeight : 'bold' ,
153+ } ,
154+ text : {
155+ fontSize : 18 ,
156+ borderColor : "white" ,
157+ paddingVertical : 4 ,
158+ fontWeight : "300" ,
159+ fontStyle : "italic" ,
160+ marginLeft : 10 ,
161+ } ,
91162} ) ;
92163
93- export default DiningMenu ;
164+ export default connect ( mapStateToProps ) ( DiningMenu ) ;
0 commit comments