-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfile.tsx
84 lines (78 loc) · 1.95 KB
/
Profile.tsx
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
import { useQuery } from '@apollo/client';
import { View, Image, Text, StyleSheet } from 'react-native';
import { readRepositories } from './GraphqlQueries';
import { Feather } from '@expo/vector-icons';
type ProfileProps = {
imageUrl: string;
name: string;
userName: string;
email: string;
followersCount: number;
followingCount: number;
repositoryCount: number;
};
export default function Profile(props: ProfileProps) {
return (
<View>
<View style={styles.profileContainer}>
<Image
source={{ uri: props.imageUrl.trim() }}
style={styles.profileImage}
/>
<Text style={[styles.textStyle, { fontWeight: 'bold', fontSize: 20 }]}>
{props.name}
</Text>
<Text style={styles.textStyle}>{props.userName}</Text>
<View style={styles.profileEmail}>
<Feather
name='mail'
size={24}
color='white'
style={{ marginRight: 5 }}
/>
<Text style={styles.textStyle}>{props.email}</Text>
</View>
</View>
<View style={styles.detailsContainer}>
<View style={styles.detailsColumn}>
<Text style={styles.textStyle}>{props.followersCount}</Text>
<Text style={styles.textStyle}>Followers</Text>
</View>
<View style={styles.detailsColumn}>
<Text style={styles.textStyle}>{props.followingCount}</Text>
<Text style={styles.textStyle}>Following</Text>
</View>
<View style={styles.detailsColumn}>
<Text style={styles.textStyle}>{props.repositoryCount}</Text>
<Text style={styles.textStyle}>Repositories</Text>
</View>
</View>
</View>
);
}
const styles = StyleSheet.create({
profileContainer: {
marginVertical: 20,
alignItems: 'center',
},
profileEmail: {
flexDirection: 'row',
},
profileImage: {
height: 60,
width: 60,
borderRadius: 30,
},
detailsContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
},
detailsColumn: {
alignItems: 'center',
},
textStyle: {
color: 'white',
fontSize: 15,
marginBottom: 5,
},
});