-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrisk-country.js
52 lines (46 loc) · 1.5 KB
/
risk-country.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
import React from "react";
import { Trail, Spring, Transition } from "react-spring/dist/native";
import styled from "styled-components";
import { Dimensions, View, Image, Text } from "react-native";
const Country = ({ con, percent }) => (
<View style={{ justifyContent: "center", alignItems: "center" }}>
<Image style={{ width: 80, height: 80 }} source={conMap[con]} />
<Text style={{ fontFamily: "poppins-bold", color: "#fff", fontSize: 36 }}>
{percent}%
</Text>
</View>
);
const CardContent = styled.View`
padding: ${props => (props.noPadding ? "0 0" : "40px 20px")};
position: relative;
flex: 1;
`;
const Section = styled.Text`
font-size: 28px;
color: #ffffff;
opacity: 0.8;
font-family: "poppins-bold";
`;
const conMap = {
can: require("./assets/can.png"),
kr: require("./assets/kr.png"),
us: require("./assets/us.png"),
cn: require("./assets/cn.png")
};
export default isActive => (
<Spring from={{ opacity: 0 }} to={{ opacity: isActive ? 1 : 0 }}>
{styles => (
<CardContent style={styles}>
<Section style={{ marginBottom: 20 }}>Risk Country</Section>
<View style={{ flexDirection: "row", justifyContent: "space-around" }}>
<Country con="cn" percent="60" />
<Country con="can" percent="20" />
</View>
<View style={{ flexDirection: "row", justifyContent: "space-around" }}>
<Country con="us" percent="10" />
<Country con="kr" percent="10" />
</View>
</CardContent>
)}
</Spring>
);