fln-espranza 0.0.45 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/images/bg-stat.png +0 -0
- package/components/EStat.tsx +40 -17
- package/package.json +1 -1
|
Binary file
|
package/components/EStat.tsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TouchableOpacity, View } from "react-native";
|
|
2
|
+
import { ImageBackground, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import tw from "../../../lib/tailwind";
|
|
4
4
|
import EText from "./EText";
|
|
5
|
+
import { Colors } from "fln-espranza/utils/Color";
|
|
5
6
|
|
|
6
7
|
interface IProps {
|
|
7
8
|
stat: string;
|
|
8
9
|
target: string;
|
|
9
10
|
label: string;
|
|
10
|
-
|
|
11
|
+
bgColor?: string;
|
|
11
12
|
iconR?: JSX.Element;
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -15,27 +16,49 @@ export default function EStat({
|
|
|
15
16
|
stat,
|
|
16
17
|
target,
|
|
17
18
|
label,
|
|
18
|
-
percentage,
|
|
19
19
|
iconR,
|
|
20
|
+
bgColor
|
|
20
21
|
}: IProps) {
|
|
22
|
+
|
|
23
|
+
const percentage = Math.round((parseFloat(stat) / parseFloat(target)) * 100);
|
|
24
|
+
// const textColor = 'text-slate-800';
|
|
25
|
+
const textColor = 'text-white';
|
|
26
|
+
|
|
21
27
|
return (
|
|
22
28
|
<TouchableOpacity
|
|
23
|
-
style={tw`p-4 bg-white rounded-
|
|
29
|
+
style={[tw`p-4 bg-white rounded-2xl flex-1 `, {
|
|
30
|
+
shadowColor: '#155e75',
|
|
31
|
+
shadowOffset: { width: 0, height: 6 },
|
|
32
|
+
shadowOpacity: 0.25,
|
|
33
|
+
shadowRadius: 8,
|
|
34
|
+
}]}
|
|
24
35
|
activeOpacity={0.8}
|
|
25
36
|
>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
<ImageBackground
|
|
38
|
+
source={require('../assets/images/bg-stat.png')}
|
|
39
|
+
resizeMode="cover"
|
|
40
|
+
>
|
|
41
|
+
<View style={tw`flex-row mb-1`}>
|
|
42
|
+
<EText style={tw`text-3xl font-extrabold ${textColor} -tracking-0.25 -mt-1`}>
|
|
43
|
+
{stat}
|
|
44
|
+
</EText>
|
|
45
|
+
<EText size="sm" style={tw`ml-1 pt-1 ${textColor} opacity-50 flex-1 font-medium`}>
|
|
46
|
+
/ {target}
|
|
47
|
+
</EText>
|
|
48
|
+
{iconR}
|
|
49
|
+
</View>
|
|
50
|
+
{/* PROGRESSBAR */}
|
|
51
|
+
<View style={tw`flex-row`}>
|
|
52
|
+
<View style={tw`bg-slate-200 h-1 rounded-full mb-1 mt-2 overflow-hidden flex-1 mr-3`}>
|
|
53
|
+
<View style={[tw`h-1 w-32 bg-teal-400`, { width: percentage }]}></View>
|
|
54
|
+
</View>
|
|
55
|
+
<EText size="xs" style={tw`text-teal-400 font-bold`}>
|
|
56
|
+
{percentage}%
|
|
57
|
+
</EText>
|
|
58
|
+
</View>
|
|
59
|
+
<EText style={tw`font-bold mt-2 ${textColor}`}>{label}</EText>
|
|
60
|
+
<EText size="xs" style={tw` ${textColor} opacity-60 font-medium`}>This month</EText>
|
|
61
|
+
</ImageBackground>
|
|
39
62
|
</TouchableOpacity>
|
|
40
63
|
);
|
|
41
64
|
}
|