File size: 412 Bytes
0ad74ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script lang="ts">
	import { svgCopy, svgCheck } from "$lib/assets/copy.js";

	export let content: string = "";

	let copied = false;
	async function copy() {
		await navigator.clipboard.writeText(content);
		copied = true;
		setTimeout(() => (copied = false), 2000);
	}
</script>

<button on:click={copy} role="button" tabindex={0}>
	{#if !copied}
		{@html svgCopy}
	{:else}
		{@html svgCheck}
	{/if}
</button>