File tree 1 file changed +36
-17
lines changed
packages/insight/src/components
1 file changed +36
-17
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,17 @@ import TickSvg from '../assets/images/tick.svg';
8
8
const CopyImg = styled ( motion . div ) `
9
9
margin: auto 0.25rem;
10
10
display: inline-block;
11
+ width: 12px;
12
+ height: 12px;
13
+ position: relative;
14
+ ` ;
15
+
16
+ const IconImage = styled ( motion . img ) `
17
+ position: absolute;
18
+ top: 0;
19
+ left: 0;
20
+ width: 100%;
21
+ height: 100%;
11
22
` ;
12
23
13
24
interface CopyTextProps {
@@ -49,25 +60,33 @@ const CopyText: FC<CopyTextProps> = ({text}) => {
49
60
} ;
50
61
51
62
return (
52
- < AnimatePresence >
53
- { copied ? (
54
- < CopyImg key = 'tick' variants = { copyAnime } exit = 'exit' initial = 'initial' animate = 'animate' >
55
- < img src = { TickSvg } width = { 12 } height = { 12 } alt = 'tick' />
56
- </ CopyImg >
57
- ) : (
58
- < CopyToClipboard text = { text } onCopy = { ( ) => onClickCopy ( ) } >
59
- < CopyImg
60
- key = 'copy'
63
+ < CopyImg >
64
+ < AnimatePresence mode = { 'wait' } >
65
+ { copied ? (
66
+ < IconImage
67
+ key = 'tick'
68
+ src = { TickSvg }
69
+ alt = 'tick'
61
70
variants = { copyAnime }
62
- whileHover = 'whileHover'
63
- exit = 'exit'
64
71
initial = 'initial'
65
- animate = 'animate' >
66
- < img src = { CopySvg } width = { 12 } height = { 12 } alt = 'copy' />
67
- </ CopyImg >
68
- </ CopyToClipboard >
69
- ) }
70
- </ AnimatePresence >
72
+ animate = 'animate'
73
+ exit = 'exit'
74
+ />
75
+ ) : (
76
+ < CopyToClipboard text = { text } onCopy = { ( ) => onClickCopy ( ) } >
77
+ < IconImage
78
+ key = 'copy'
79
+ src = { CopySvg }
80
+ alt = 'copy'
81
+ variants = { copyAnime }
82
+ initial = 'initial'
83
+ animate = 'animate'
84
+ whileHover = 'whileHover'
85
+ />
86
+ </ CopyToClipboard >
87
+ ) }
88
+ </ AnimatePresence >
89
+ </ CopyImg >
71
90
) ;
72
91
} ;
73
92
You can’t perform that action at this time.
0 commit comments