-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathEmptyStateIndicator.tsx
More file actions
47 lines (38 loc) · 1.17 KB
/
EmptyStateIndicator.tsx
File metadata and controls
47 lines (38 loc) · 1.17 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
import React from 'react';
import { useTranslationContext } from '../../context/TranslationContext';
import { ChatBubble } from './icons';
export type EmptyStateIndicatorProps = {
/** List Type: channel | message */
listType?: 'channel' | 'message' | 'thread';
};
const UnMemoizedEmptyStateIndicator = (props: EmptyStateIndicatorProps) => {
const { listType } = props;
const { t } = useTranslationContext('EmptyStateIndicator');
if (listType === 'thread') return null;
if (listType === 'channel') {
const text = t('You have no channels currently');
return (
<>
<div className='str-chat__channel-list-empty'>
<ChatBubble />
<p role='listitem'>{text}</p>
</div>
</>
);
}
if (listType === 'message') {
const text = t('No chats here yet…');
return (
<div className='str-chat__empty-channel'>
<ChatBubble />
<p className='str-chat__empty-channel-text' role='listitem'>
{text}
</p>
</div>
);
}
return <p>No items exist</p>;
};
export const EmptyStateIndicator = React.memo(
UnMemoizedEmptyStateIndicator,
) as typeof UnMemoizedEmptyStateIndicator;