-
Notifications
You must be signed in to change notification settings - Fork 2
/
ProfileSignature.tsx
60 lines (56 loc) · 1.39 KB
/
ProfileSignature.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
import * as React from "react";
import {ReactNode} from "react";
import {View, StyleSheet} from "react-native";
import {ProfileImage} from "./ProfileImage";
import {LabelText, LiteText, BodyText} from "./Text";
import {lineHeight} from "./StyleConstants";
/**
* Used to “sign” some content with a user’s profile and the time at which the
* content was created. The user’s profile image is put on the left and their
* name is included above the body content.
*/
export function ProfileSignature({
name,
image,
time,
children,
}: {
name: string;
image: string;
time: string;
children: ReactNode;
}) {
return (
<View style={styles.container}>
<ProfileImage image={image} />
<View style={styles.body}>
<View style={styles.header}>
<LabelText>{name}</LabelText>
<View style={styles.headerTime}>
<LiteText>{time}</LiteText>
</View>
</View>
{children}
</View>
</View>
);
}
ProfileSignature.sidebarWidth = ProfileImage.size + lineHeight / 2;
ProfileSignature.maxWidth =
ProfileImage.size + lineHeight / 2 + BodyText.maxWidth;
const styles = StyleSheet.create({
container: {
flexDirection: "row",
},
body: {
flex: 1,
maxWidth: BodyText.maxWidth,
paddingLeft: lineHeight / 2,
},
header: {
flexDirection: "row",
},
headerTime: {
paddingLeft: lineHeight / 2,
},
});