-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(botonic-react): create typing indicator with typescript and …
…styled component
- Loading branch information
Showing
5 changed files
with
57 additions
and
56 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
packages/botonic-react/src/webchat/components/typing-indicator.jsx
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
packages/botonic-react/src/webchat/components/typing-indicator.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/botonic-react/src/webchat/typing-indicator/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
|
||
import { Dot, TypingIndicatorWrapper } from './styles' | ||
|
||
export const TypingIndicator = () => ( | ||
<TypingIndicatorWrapper> | ||
<Dot /> | ||
<Dot /> | ||
<Dot /> | ||
</TypingIndicatorWrapper> | ||
) |
45 changes: 45 additions & 0 deletions
45
packages/botonic-react/src/webchat/typing-indicator/styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import styled, { keyframes } from 'styled-components' | ||
|
||
const blink = keyframes` | ||
50% { | ||
opacity: 1; | ||
} | ||
` | ||
|
||
const bulge = keyframes` | ||
50% { | ||
transform: scale(1.05); | ||
} | ||
` | ||
|
||
export const TypingIndicatorWrapper = styled.div` | ||
will-change: transform; | ||
width: 44px; | ||
line-height: 0px; | ||
border-radius: 20px; | ||
padding: 8px 2px 8px; | ||
text-align: center; | ||
display: block; | ||
margin: 8px; | ||
position: relative; | ||
animation: 2s ${bulge} infinite ease-out; | ||
` | ||
|
||
export const Dot = styled.span` | ||
height: 6px; | ||
width: 6px; | ||
margin: 0 1px; | ||
background-color: #9e9ea1; | ||
display: inline-block; | ||
border-radius: 50%; | ||
opacity: 0.4; | ||
&:nth-of-type(1) { | ||
animation: 1s ${blink} infinite 0.3333s; | ||
} | ||
&:nth-of-type(2) { | ||
animation: 1s ${blink} infinite 0.6666s; | ||
} | ||
&:nth-of-type(3) { | ||
animation: 1s ${blink} infinite 1s; | ||
} | ||
` |