File tree Expand file tree Collapse file tree 1 file changed +43
-3
lines changed
packages/repl/src/lib/Input Expand file tree Collapse file tree 1 file changed +43
-3
lines changed Original file line number Diff line number Diff line change 3
3
import type { Workspace , File } from ' ../Workspace.svelte' ;
4
4
import { tick } from ' svelte' ;
5
5
import { Checkbox , Toolbox } from ' @sveltejs/site-kit/components' ;
6
- import { page } from ' $app/state' ;
7
- import { SvelteURL , SvelteURLSearchParams } from ' svelte/reactivity' ;
8
6
9
7
interface Props {
10
8
runes: boolean ;
193
191
{/if }
194
192
195
193
<button
194
+ class =" copy-button"
195
+ title =" Copy to clipboard"
196
+ aria-label =" Copy to clipboard"
196
197
onclick ={() => {
197
198
navigator .clipboard .writeText (
198
199
` npx sv create --from-playground="${window .location .href }" `
199
200
);
200
- alert (' Copied to clipboard! You can now paste it into your terminal.' );
201
201
}}
202
202
>
203
203
Copy <code >sv create --from-playground</code >
373
373
stroke-linejoin : round ;
374
374
fill : none ;
375
375
}
376
+
377
+ .copy-button {
378
+ position : relative ;
379
+ height : 3.6rem ;
380
+ margin-right : 2rem ;
381
+
382
+ &::before,
383
+ &::after {
384
+ content : ' ' ;
385
+ display : block ;
386
+ position : absolute ;
387
+ width : 100% ;
388
+ height : 100% ;
389
+ right : 1.1rem ;
390
+ top : 1.1rem ;
391
+ background : currentColor ;
392
+ mask : no-repeat 100% 0% / 1.6rem 1.6rem ;
393
+ transition : opacity 0.2s ;
394
+ transition-delay : 0.6s ;
395
+ }
396
+
397
+ &::before {
398
+ mask-image : url (icons/copy-to-clipboard );
399
+ }
400
+
401
+ &::after {
402
+ mask-image : url (icons/check );
403
+ opacity : 0 ;
404
+ }
405
+
406
+ &:active ::before {
407
+ opacity : 0 ;
408
+ transition : none ;
409
+ }
410
+
411
+ &:active ::after {
412
+ opacity : 1 ;
413
+ transition : none ;
414
+ }
415
+ }
376
416
</style >
You can’t perform that action at this time.
0 commit comments