File tree 1 file changed +9
-24
lines changed
1 file changed +9
-24
lines changed Original file line number Diff line number Diff line change 1
- import { Suspense , lazy , useState } from 'react'
1
+ import { Suspense , lazy } from 'react'
2
2
3
3
import comma from '../assets/comma.svg'
4
4
import qdlPorts from '../assets/qdl-ports.svg'
@@ -14,29 +14,14 @@ const PRODUCT_ID = '9008'
14
14
const DETACH_SCRIPT = 'for d in /sys/bus/usb/drivers/qcserial/*-*; do [ -e "$d" ] && echo -n "$(basename $d)" | sudo tee /sys/bus/usb/drivers/qcserial/unbind > /dev/null; done' ;
15
15
16
16
function CopyText ( { children : text } ) {
17
- const [ copied , setCopied ] = useState ( false )
18
- const handleCopy = ( ) => {
19
- setCopied ( true )
20
- setTimeout ( ( ) => {
21
- setCopied ( false )
22
- } , 1000 )
23
- }
24
-
25
- return < div className = "relative w-full" >
26
- < pre className = "font-mono text-sm px-4 py-6" >
27
- { text }
28
- </ pre >
29
- < div className = "absolute top-2 right-2" >
30
- < button
31
- onClick = { ( ) => {
32
- void navigator . clipboard . writeText ( text ) ;
33
- handleCopy ( ) ;
34
- } }
35
- className = { `bg-${ copied ? 'green' : 'blue' } -500 text-white px-1 py-1 rounded-md ml-2 text-sm` }
36
- >
37
- Copy
38
- </ button >
39
- </ div >
17
+ return < div className = "relative text-sm" >
18
+ < pre className = "font-mono pt-12" > { text } </ pre >
19
+ < button
20
+ onClick = { ( ) => navigator . clipboard . writeText ( text ) }
21
+ className = { "absolute top-2 right-2 bg-blue-600 hover:bg-blue-500 active:bg-blue-300 transition-colors text-white p-1 rounded-md" }
22
+ >
23
+ Copy
24
+ </ button >
40
25
</ div > ;
41
26
}
42
27
You can’t perform that action at this time.
0 commit comments