File tree Expand file tree Collapse file tree 1 file changed +26
-28
lines changed
apps/website/src/components/code-copy Expand file tree Collapse file tree 1 file changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -7,36 +7,34 @@ export type CodeCopyProps = PropsOf<typeof Button> & {
7
7
code ?: string ;
8
8
} ;
9
9
10
- export const CodeCopy = component$ < CodeCopyProps > (
11
- ( { code = '' , class : outsideClass , ...props } ) => {
12
- const copied = useSignal ( false ) ;
10
+ export const CodeCopy = component$ < CodeCopyProps > ( ( { code = '' , ...props } ) => {
11
+ const copied = useSignal ( false ) ;
13
12
14
- return (
15
- < Button
16
- { ...props }
17
- look = "ghost"
18
- title = { copied . value ? 'Copied to Clipboard' : 'Copy to Clipboard' }
19
- class = { cn ( outsideClass ) }
20
- onClick$ = { async ( ) => {
21
- await copy ( code ) ;
22
- copied . value = true ;
13
+ return (
14
+ < Button
15
+ { ...props }
16
+ look = "ghost"
17
+ title = { copied . value ? 'Copied to Clipboard' : 'Copy to Clipboard' }
18
+ class = { cn ( props . class ) }
19
+ onClick$ = { async ( ) => {
20
+ await copy ( code ) ;
21
+ copied . value = true ;
23
22
24
- setTimeout ( ( ) => {
25
- copied . value = false ;
26
- } , 4000 ) ;
27
- } }
28
- >
29
- { ! copied . value ? (
30
- < CopyIcon />
31
- ) : (
32
- < div class = "flex gap-1" >
33
- < ClipboardCheck />
34
- </ div >
35
- ) }
36
- </ Button >
37
- ) ;
38
- } ,
39
- ) ;
23
+ setTimeout ( ( ) => {
24
+ copied . value = false ;
25
+ } , 4000 ) ;
26
+ } }
27
+ >
28
+ { ! copied . value ? (
29
+ < CopyIcon />
30
+ ) : (
31
+ < div class = "flex gap-1" >
32
+ < ClipboardCheck />
33
+ </ div >
34
+ ) }
35
+ </ Button >
36
+ ) ;
37
+ } ) ;
40
38
41
39
export function CopyIcon ( props : PropsOf < 'svg' > & { color ?: string } , key : string ) {
42
40
return (
You can’t perform that action at this time.
0 commit comments