-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathPollAvatarHeader.tsx
More file actions
86 lines (81 loc) · 2.03 KB
/
Copy pathPollAvatarHeader.tsx
File metadata and controls
86 lines (81 loc) · 2.03 KB
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
85
86
import {Text, View, StyleSheet} from 'react-native';
import React from 'react';
import {PollItem} from '../context/poll-context';
import {
useContent,
UserAvatar,
ThemeConfig,
useString,
videoRoomUserFallbackText,
UidType,
$config,
} from 'customization-api';
interface Props {
pollItem: PollItem;
}
function PollAvatarHeader({pollItem}: Props) {
const remoteUserDefaultLabel = useString(videoRoomUserFallbackText)();
const {defaultContent} = useContent();
const getPollCreaterName = ({uid, name}: {uid: UidType; name: string}) => {
return defaultContent[uid]?.name || name || remoteUserDefaultLabel;
};
return (
<View style={style.titleCard}>
<View style={style.titleAvatar}>
<UserAvatar
name={getPollCreaterName(pollItem.createdBy)}
containerStyle={style.titleAvatarContainer}
textStyle={style.titleAvatarContainerText}
/>
</View>
<View style={style.title}>
<Text style={style.titleText}>
{getPollCreaterName(pollItem.createdBy)}
</Text>
<Text style={style.titleSubtext}>{pollItem.type}</Text>
</View>
</View>
);
}
export const style = StyleSheet.create({
titleCard: {
display: 'flex',
flexDirection: 'row',
gap: 12,
},
title: {
display: 'flex',
flexDirection: 'column',
gap: 2,
},
titleAvatar: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
titleAvatarContainer: {
width: 36,
height: 36,
borderRadius: 18,
backgroundColor: $config.VIDEO_AUDIO_TILE_AVATAR_COLOR,
},
titleAvatarContainerText: {
fontSize: ThemeConfig.FontSize.small,
lineHeight: 16,
fontWeight: '600',
color: $config.VIDEO_AUDIO_TILE_COLOR,
},
titleText: {
color: $config.FONT_COLOR,
fontSize: ThemeConfig.FontSize.normal,
fontWeight: '700',
lineHeight: 20,
},
titleSubtext: {
color: $config.FONT_COLOR,
fontSize: ThemeConfig.FontSize.tiny,
fontWeight: '400',
lineHeight: 16,
},
});
export default PollAvatarHeader;