Skip to content

Commit f465a0e

Browse files
jycouetRich-Harris
andauthored
feat: add new cmd in the Playground sv create --from-playground (#1537)
* feat: add new cmd in the Playground `sv create --from-playground` * css > alert * title & aria-label Co-authored-by: Rich Harris <[email protected]> * button text Co-authored-by: Rich Harris <[email protected]> * remove implicit size Co-authored-by: Rich Harris <[email protected]> * position & mask Co-authored-by: Rich Harris <[email protected]> --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 881603b commit f465a0e

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

packages/repl/src/lib/Input/ComponentSelector.svelte

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@
189189
{#if download}
190190
<button onclick={download}>Download app</button>
191191
{/if}
192+
193+
<button
194+
class="copy-button"
195+
title="Copy `npx sv create --from-playground=&quot;...&quot;` to clipboard"
196+
aria-label="Copy `npx sv create --from-playground=&quot;...&quot;` to clipboard"
197+
onclick={() => {
198+
navigator.clipboard.writeText(
199+
`npx sv create --from-playground="${window.location.href}"`
200+
);
201+
}}
202+
>
203+
Set up locally
204+
</button>
192205
</Toolbox>
193206
</div>
194207
</div>
@@ -360,4 +373,42 @@
360373
stroke-linejoin: round;
361374
fill: none;
362375
}
376+
377+
.copy-button {
378+
position: relative;
379+
380+
&::before,
381+
&::after {
382+
content: '';
383+
display: block;
384+
position: absolute;
385+
width: 100%;
386+
height: 100%;
387+
right: 0;
388+
top: 0;
389+
background: currentColor;
390+
mask: no-repeat calc(100% - 1rem) 50% / 1.6rem 1.6rem;
391+
transition: opacity 0.2s;
392+
transition-delay: 0.6s;
393+
}
394+
395+
&::before {
396+
mask-image: url(icons/copy-to-clipboard);
397+
}
398+
399+
&::after {
400+
mask-image: url(icons/check);
401+
opacity: 0;
402+
}
403+
404+
&:active::before {
405+
opacity: 0;
406+
transition: none;
407+
}
408+
409+
&:active::after {
410+
opacity: 1;
411+
transition: none;
412+
}
413+
}
363414
</style>

0 commit comments

Comments
 (0)