Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions packages/repl/src/lib/Input/ComponentSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@
{#if download}
<button onclick={download}>Download app</button>
{/if}

<button
class="copy-button"
title="Copy `npx sv create --from-playground=&quot;...&quot;` to clipboard"
aria-label="Copy `npx sv create --from-playground=&quot;...&quot;` to clipboard"
onclick={() => {
navigator.clipboard.writeText(
`npx sv create --from-playground="${window.location.href}"`
);
}}
>
Set up locally
</button>
</Toolbox>
</div>
</div>
Expand Down Expand Up @@ -360,4 +373,42 @@
stroke-linejoin: round;
fill: none;
}

.copy-button {
position: relative;

&::before,
&::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
right: 0;
top: 0;
background: currentColor;
mask: no-repeat calc(100% - 1rem) 50% / 1.6rem 1.6rem;
transition: opacity 0.2s;
transition-delay: 0.6s;
}

&::before {
mask-image: url(icons/copy-to-clipboard);
}

&::after {
mask-image: url(icons/check);
opacity: 0;
}

&:active::before {
opacity: 0;
transition: none;
}

&:active::after {
opacity: 1;
transition: none;
}
}
</style>