/
Entries.js
126 lines (121 loc) · 3.42 KB
/
Entries.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
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen';
import RF from "react-native-responsive-fontsize";
import { lightText } from './helpers/textColors';
const type = {
earth: 'Earth Entry',
ocean: 'Ocean Entry',
animal: 'Animal Entry',
humanity: 'Humanity Entry'
};
const secondColor = {
earth: '#599F71',
ocean: '#36307B',
animal: '#787262',
humanity: '#DB8354'
};
class Entries extends Component {
render() {
let oceanCapitalized;
if (this.props.type === 'ocean') {
oceanCapitalized = this.props.ocean.charAt(0).toUpperCase() + this.props.ocean.slice(1);
}
let header1;
let header2;
let header3;
if (this.props.statsType === 'myStats') {
header1 = (this.props.type === 'ocean' ? oceanCapitalized : `${this.props.stateRegion}, ${this.props.country}`);
header2 = this.props.timeStamp;
header3 = type[this.props.type];
} else if (this.props.statsType === 'globalStats') {
header1 = this.props.username;
header2 = (this.props.type === 'ocean' ? oceanCapitalized : `${this.props.stateRegion}, ${this.props.country}`);
header3 = this.props.timeStamp;
}
return (
<View style={[styles.entriesContainer, { marginLeft: (this.props.index === 0 ? wp('7%') : wp('4%')) }]}>
<View style={[styles.entriesInnerContainer, { backgroundColor: this.props.color }]}>
<View style={styles.entriesInnerContainerFlex}>
<Text style={styles.entriesHeader1}>{header1}</Text>
<Text style={styles.entriesHeader2}>{header2}</Text>
{/* <Text style={styles.entriesType}>{type[this.props.type]}</Text> */}
<Text style={styles.entriesHeader3}>{header3}</Text>
</View>
</View>
<View style={[styles.entriesContentContainer, { backgroundColor: secondColor[this.props.type] }]}>
<Text style={styles.entriesContent}>{this.props.entry}</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
entriesContainer: {
height: hp('26%'),
width: wp('85%'),
borderWidth: 1.5,
borderRadius: 6,
borderColor: '#a3a3a3',
// overflow: 'hidden',
marginRight: wp('2%'),
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 4,
},
shadowOpacity: 0.3,
shadowRadius: 4.65,
elevation: 8,
},
entriesInnerContainer: {
flex: 5,
alignItems: 'center',
borderBottomWidth: 2,
borderBottomColor: '#F3F3E1',
},
entriesInnerContainerFlex: {
flex: 1,
justifyContent: 'space-evenly',
},
entriesContentContainer: {
flex: 6,
alignItems: 'center',
justifyContent: 'center'
},
entriesHeader1: {
flex: 1,
fontSize: RF(3.1),
textAlign: 'center',
fontWeight: '700',
marginTop: 3,
color: lightText
},
entriesHeader2: {
flex: 1,
fontSize: RF(2.5),
fontWeight: '700',
color: lightText,
textAlign: 'center',
},
// entriesType: {
// flex: 1,
// textAlign: 'center',
// fontSize: RF(2),
// fontWeight: '400',
// color: lightText,
// },
entriesHeader3: {
fontSize: RF(2.1),
color: lightText,
marginBottom: 3,
textAlign: 'center',
},
entriesContent: {
fontSize: RF(3),
padding: wp('2%'),
textAlign: 'center',
color: lightText
}
});
export default Entries;