forked from microsoft/BotFramework-WebChat
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTypingAnimation.js
More file actions
41 lines (35 loc) · 1.21 KB
/
TypingAnimation.js
File metadata and controls
41 lines (35 loc) · 1.21 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
import { hooks } from 'botframework-webchat-api';
import classNames from 'classnames';
import React from 'react';
import ScreenReaderText from '../ScreenReaderText';
import { useStyleToEmotionObject } from '../hooks/internal/styleToEmotionObject';
import testIds from '../testIds';
import useStyleSet from '../hooks/useStyleSet';
const { useDirection, useLocalizer } = hooks;
const ROOT_STYLE = {
'&.webchat__typing-indicator.webchat__typing-indicator--rtl': { transform: 'scale(-1, 1)' }
};
const TypingAnimation = () => {
const [{ typingAnimation: typingAnimationStyleSet }] = useStyleSet();
const [direction] = useDirection();
const localize = useLocalizer();
const rootClassName = useStyleToEmotionObject()(ROOT_STYLE) + '';
return (
<React.Fragment>
<ScreenReaderText text={localize('TYPING_INDICATOR_ALT')} />
<div
aria-hidden={true}
className={classNames(
'webchat__typing-indicator',
{
'webchat__typing-indicator--rtl': direction === 'rtl'
},
rootClassName,
typingAnimationStyleSet + ''
)}
data-testid={testIds.typingIndicator}
/>
</React.Fragment>
);
};
export default TypingAnimation;