File tree 4 files changed +646
-153
lines changed
4 files changed +646
-153
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright 2024, Command Line Inc.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- $dot-width : 11px ;
5
- $dot-color : var (--success-color );
6
- $speed : 1.5s ;
4
+ .typing-indicator {
5
+ display : inline-flex ;
6
+ align-items : center ;
7
+ gap : 8px ;
8
+ margin : 0 ;
9
+ padding : 0 ;
7
10
8
- .typing {
9
- position : relative ;
10
- height : $dot-width ;
11
+ & -bubble {
12
+ display : flex ;
13
+ align-items : center ;
14
+ justify-content : center ;
15
+ background-color : rgba (from var (--accent-color ) r g b / 0.1 );
16
+ border-radius : 20px ;
17
+ padding : 6px 12px ;
18
+ gap : 4px ;
19
+ }
11
20
12
- span {
13
- content : " " ;
14
- animation : blink $speed infinite ;
15
- animation-fill-mode : both ;
16
- height : $dot-width ;
17
- width : $dot-width ;
18
- background : $dot-color ;
19
- position : absolute ;
20
- left : 0 ;
21
- top : 0 ;
21
+ & -dot {
22
+ width : 6px ;
23
+ height : 6px ;
22
24
border-radius : 50% ;
25
+ background-color : var (--accent-color );
26
+ opacity : 0.7 ;
27
+
28
+ & :nth-child (1 ) {
29
+ animation : typing- animation 1.4s infinite ease-in-out ;
30
+ animation-delay : 0s ;
31
+ }
23
32
24
33
& :nth-child (2 ) {
34
+ animation : typing- animation 1.4s infinite ease-in-out ;
25
35
animation-delay : 0.2s ;
26
- margin-left : $dot-width * 1.5 ;
27
36
}
28
37
29
38
& :nth-child (3 ) {
39
+ animation : typing- animation 1.4s infinite ease-in-out ;
30
40
animation-delay : 0.4s ;
31
- margin-left : $dot-width * 3 ;
32
41
}
33
42
}
34
43
}
35
44
36
- @keyframes blink {
37
- 0% {
38
- opacity : 0.1 ;
45
+ @keyframes typing-animation {
46
+ 0%,
47
+ 100% {
48
+ transform : translateY (0 );
39
49
}
40
- 20% {
50
+ 50% {
51
+ transform : translateY (-5px );
41
52
opacity : 1 ;
42
53
}
43
- 100% {
44
- opacity : 0.1 ;
45
- }
46
54
}
Original file line number Diff line number Diff line change 1
1
// Copyright 2025, Command Line Inc.
2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
- import { clsx } from "clsx" ;
5
-
4
+ import React from "react" ;
6
5
import "./typingindicator.scss" ;
7
6
8
- type TypingIndicatorProps = {
7
+ export interface TypingIndicatorProps {
8
+ style ?: React . CSSProperties ;
9
9
className ?: string ;
10
- } ;
11
- const TypingIndicator = ( { className } : TypingIndicatorProps ) => {
10
+ }
11
+
12
+ export const TypingIndicator : React . FC < TypingIndicatorProps > = ( { style, className } ) => {
12
13
return (
13
- < div className = { clsx ( "typing" , className ) } >
14
- < span > </ span >
15
- < span > </ span >
16
- < span > </ span >
14
+ < div className = { `typing-indicator ${ className || "" } ` } style = { style } >
15
+ < div className = "typing-indicator-bubble" >
16
+ < div className = "typing-indicator-dot" > </ div >
17
+ < div className = "typing-indicator-dot" > </ div >
18
+ < div className = "typing-indicator-dot" > </ div >
19
+ </ div >
17
20
</ div >
18
21
) ;
19
22
} ;
20
-
21
- export { TypingIndicator } ;
You can’t perform that action at this time.
0 commit comments