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 104104 min-width : 1.5em ;
105105 min-height : 1.5em ;
106106 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+ }
107120}
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ export function CopyButton({
1212 const [ copied , setCopied ] = React . useState ( false )
1313
1414 return (
15- < svg
15+ < button
16+ type = "button"
17+ className = { className }
1618 style = { style }
1719 onClick = { ( ) => {
1820 copyToClipboard ( content )
@@ -21,30 +23,32 @@ export function CopyButton({
2123 setCopied ( false )
2224 } , 1200 )
2325 } }
24- fill = "none"
25- stroke = "currentColor"
26- viewBox = "0 0 24 24"
27- xmlns = "http://www.w3.org/2000/svg"
28- className = { className }
2926 >
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 >
3134
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 >
4852 )
4953}
5054
You can’t perform that action at this time.
0 commit comments