-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathChannelDetailProfileSection.tsx
More file actions
79 lines (73 loc) · 1.95 KB
/
ChannelDetailProfileSection.tsx
File metadata and controls
79 lines (73 loc) · 1.95 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
import React, { useMemo } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { ChannelPreviewMutedStatus, useTheme } from 'stream-chat-react-native';
type ChannelDetailProfileSectionProps = {
avatar: React.ReactNode;
muted?: boolean;
subtitle: string;
title: string;
};
export const ChannelDetailProfileSection = React.memo(
({ avatar, muted, subtitle, title }: ChannelDetailProfileSectionProps) => {
const {
theme: { semantics },
} = useTheme();
const styles = useStyles();
return (
<View style={styles.container}>
{avatar}
<View style={styles.heading}>
<View style={styles.titleRow}>
<Text style={[styles.title, { color: semantics.textPrimary }]} numberOfLines={2}>
{title}
</Text>
{muted ? <ChannelPreviewMutedStatus /> : null}
</View>
{subtitle ? (
<Text style={[styles.subtitle, { color: semantics.textSecondary }]} numberOfLines={1}>
{subtitle}
</Text>
) : null}
</View>
</View>
);
},
);
ChannelDetailProfileSection.displayName = 'ChannelDetailProfileSection';
const useStyles = () =>
useMemo(
() =>
StyleSheet.create({
container: {
alignItems: 'center',
gap: 16,
paddingHorizontal: 0,
},
heading: {
alignItems: 'center',
gap: 8,
width: '100%',
},
titleRow: {
alignItems: 'center',
flexDirection: 'row',
gap: 4,
justifyContent: 'center',
maxWidth: '100%',
},
title: {
fontSize: 22,
flexShrink: 1,
fontWeight: '600',
lineHeight: 24,
textAlign: 'center',
},
subtitle: {
fontSize: 15,
fontWeight: '400',
lineHeight: 20,
textAlign: 'center',
},
}),
[],
);