-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.js
46 lines (43 loc) · 1.22 KB
/
view.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
import React from "react"
import { View, Text } from "react-native"
import { Avatar } from "react-native-elements"
import { Color, styles } from "./styles"
import { getInitials, transformLabel } from "./utils"
const UserInfo = props => (
<View>
<Text style={styles.label}>{transformLabel(props.label)}</Text>
<Text style={styles.text}>
{props.value ? props.value : "Not available"}
</Text>
</View>
)
const ViewUser = props => {
const { user } = props
const initials = getInitials(user)
return (
<View>
{user.id ? (
<View>
<View style={styles.profileIcon}>
<Avatar
size="large"
rounded
icon={{ name: "user", type: "font-awesome" }}
title={initials}
containerStyle={{ backgroundColor: Color.pink }}
/>
</View>
<UserInfo
label="Name"
value={`${user.first_name} ${user.last_name}`}
/>
<UserInfo label="Email" value={user.email} />
<UserInfo label="Biography" value={user.bio} />
</View>
) : (
<Text style={styles.label}>No user information available.</Text>
)}
</View>
)
}
export default ViewUser