@@ -10,6 +10,31 @@ const UNIX_COMMAND =
1010const WINDOWS_COMMAND =
1111 'powershell -c "irm https://github.com/php-debugger/installer/releases/latest/download/install.ps1 | iex"' ;
1212
13+ const iconProps = {
14+ width : 15 ,
15+ height : 15 ,
16+ viewBox : '0 0 24 24' ,
17+ fill : 'none' ,
18+ stroke : 'currentColor' ,
19+ strokeWidth : 2 ,
20+ strokeLinecap : 'round' ,
21+ strokeLinejoin : 'round' ,
22+ 'aria-hidden' : true ,
23+ } ;
24+
25+ const CopyIcon = ( ) => (
26+ < svg { ...iconProps } >
27+ < rect x = "9" y = "9" width = "11" height = "11" rx = "2" />
28+ < path d = "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
29+ </ svg >
30+ ) ;
31+
32+ const CheckIcon = ( ) => (
33+ < svg { ...iconProps } >
34+ < path d = "M20 6 9 17l-5-5" />
35+ </ svg >
36+ ) ;
37+
1338const PLATFORMS = [
1439 { id : 'macos' , label : 'macOS' , language : 'bash' , command : UNIX_COMMAND } ,
1540 { id : 'linux' , label : 'Linux' , language : 'bash' , command : UNIX_COMMAND } ,
@@ -74,7 +99,8 @@ export default function InstallCommand() {
7499 return ok ;
75100 }
76101
77- async function copy ( ) {
102+ async function copy ( event ) {
103+ event . currentTarget . blur ( ) ;
78104 let ok = false ;
79105 try {
80106 await navigator . clipboard . writeText ( active . command ) ;
@@ -111,9 +137,10 @@ export default function InstallCommand() {
111137 </ div >
112138 < button
113139 type = "button"
114- className = { styles . copy }
140+ className = { clsx ( styles . copy , copied && styles . copied ) }
115141 onClick = { copy }
116142 aria-label = { `Copy the ${ active . label } install command` } >
143+ { copied ? < CheckIcon /> : < CopyIcon /> }
117144 { copied ? 'Copied' : 'Copy' }
118145 </ button >
119146 </ div >
0 commit comments