File tree Expand file tree Collapse file tree 2 files changed +40
-23
lines changed Expand file tree Collapse file tree 2 files changed +40
-23
lines changed Original file line number Diff line number Diff line change 104
104
min-width : 1.5em ;
105
105
min-height : 1.5em ;
106
106
margin-right : 0.8em ;
107
+
108
+ & [type = " button" ] {
109
+ background-color : transparent ;
110
+ border : 1px solid transparent ;
111
+ color : inherit ;
112
+ }
113
+
114
+ svg {
115
+ width : 1.5em ;
116
+ height : 1.5em ;
117
+ min-width : 1.5em ;
118
+ min-height : 1.5em ;
119
+ }
107
120
}
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ export function CopyButton({
12
12
const [ copied , setCopied ] = React . useState ( false )
13
13
14
14
return (
15
- < svg
15
+ < button
16
+ type = "button"
17
+ className = { className }
16
18
style = { style }
17
19
onClick = { ( ) => {
18
20
copyToClipboard ( content )
@@ -21,30 +23,32 @@ export function CopyButton({
21
23
setCopied ( false )
22
24
} , 1200 )
23
25
} }
24
- fill = "none"
25
- stroke = "currentColor"
26
- viewBox = "0 0 24 24"
27
- xmlns = "http://www.w3.org/2000/svg"
28
- className = { className }
29
26
>
30
- < title > Copy</ title >
27
+ < svg
28
+ fill = "none"
29
+ stroke = "currentColor"
30
+ viewBox = "0 0 24 24"
31
+ xmlns = "http://www.w3.org/2000/svg"
32
+ >
33
+ < title > Copy</ title >
31
34
32
- { copied ? (
33
- < path
34
- strokeLinecap = "round"
35
- strokeLinejoin = "round"
36
- strokeWidth = { 2 }
37
- d = "M5 13l4 4L19 7"
38
- />
39
- ) : (
40
- < path
41
- strokeLinecap = "round"
42
- strokeLinejoin = "round"
43
- strokeWidth = "1.6px"
44
- d = "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
45
- />
46
- ) }
47
- </ svg >
35
+ { copied ? (
36
+ < path
37
+ strokeLinecap = "round"
38
+ strokeLinejoin = "round"
39
+ strokeWidth = { 2 }
40
+ d = "M5 13l4 4L19 7"
41
+ />
42
+ ) : (
43
+ < path
44
+ strokeLinecap = "round"
45
+ strokeLinejoin = "round"
46
+ strokeWidth = "1.6px"
47
+ d = "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
48
+ />
49
+ ) }
50
+ </ svg >
51
+ </ button >
48
52
)
49
53
}
50
54
You can’t perform that action at this time.
0 commit comments