-
Notifications
You must be signed in to change notification settings - Fork 305
/
EmptyStateIndicator.tsx
82 lines (77 loc) · 2.32 KB
/
EmptyStateIndicator.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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { useTheme } from '../../contexts/themeContext/ThemeContext';
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
import { useViewport } from '../../hooks/useViewport';
import { ChatIcon, MessageIcon } from '../../icons';
const styles = StyleSheet.create({
channelContainer: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
channelDetails: {
fontSize: 14,
textAlign: 'center',
},
channelTitle: {
fontSize: 16,
paddingBottom: 8,
paddingTop: 16,
},
messageContainer: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
messageTitle: {
fontSize: 20,
fontWeight: 'bold',
paddingBottom: 8,
},
});
export type EmptyStateProps = {
listType?: 'channel' | 'message' | 'default';
};
export const EmptyStateIndicator = ({ listType }: EmptyStateProps) => {
const {
theme: {
colors: { black, grey, grey_gainsboro },
emptyStateIndicator: { channelContainer, channelDetails, channelTitle },
},
} = useTheme();
const { vw } = useViewport();
const width = vw(33);
const { t } = useTranslationContext();
switch (listType) {
case 'channel':
return (
<View style={[styles.channelContainer, channelContainer]}>
<MessageIcon height={width} pathFill={grey_gainsboro} width={width} />
<Text
style={[styles.channelTitle, { color: black }, channelTitle]}
testID='empty-channel-state-title'
>
{t<string>("Let's start chatting!")}
</Text>
<Text
style={[styles.channelDetails, { color: grey, width: vw(66) }, channelDetails]}
testID='empty-channel-state-details'
>
{t<string>('How about sending your first message to a friend?')}
</Text>
</View>
);
case 'message':
return (
<View style={[styles.messageContainer]}>
<ChatIcon height={width} pathFill={grey_gainsboro} width={width} />
<Text style={[styles.messageTitle, { color: grey_gainsboro }]}>
{t<string>('No chats here yet…')}
</Text>
</View>
);
default:
return <Text style={{ color: black }}>No items exist</Text>;
}
};