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 33 import type { Workspace , File } from ' ../Workspace.svelte' ;
44 import { tick } from ' svelte' ;
55 import { Checkbox , Toolbox } from ' @sveltejs/site-kit/components' ;
6- import { page } from ' $app/state' ;
7- import { SvelteURL , SvelteURLSearchParams } from ' svelte/reactivity' ;
86
97 interface Props {
108 runes: boolean ;
193191 {/if }
194192
195193 <button
194+ class =" copy-button"
195+ title =" Copy to clipboard"
196+ aria-label =" Copy to clipboard"
196197 onclick ={() => {
197198 navigator .clipboard .writeText (
198199 ` npx sv create --from-playground="${window .location .href }" `
199200 );
200- alert (' Copied to clipboard! You can now paste it into your terminal.' );
201201 }}
202202 >
203203 Copy <code >sv create --from-playground</code >
373373 stroke-linejoin : round ;
374374 fill : none ;
375375 }
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+ }
376416 </style >
You can’t perform that action at this time.
0 commit comments