|
|
@@ -0,0 +1,23 @@
|
|
|
+<script lang="ts">
|
|
|
+ import { Check, Copy } from '@lucide/svelte';
|
|
|
+
|
|
|
+ import { Button } from '$lib/components/controls/button';
|
|
|
+
|
|
|
+ let { content }: { content: string } = $props();
|
|
|
+
|
|
|
+ let copied = $state(false);
|
|
|
+
|
|
|
+ const onCopy = async () => {
|
|
|
+ await navigator.clipboard.writeText(content);
|
|
|
+ copied = true;
|
|
|
+ setTimeout(() => (copied = false), 2000);
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<Button size="icon-xs" variant="ghost" onclick={() => onCopy()}>
|
|
|
+ {#if copied}
|
|
|
+ <Check size={14} strokeWidth={2} />
|
|
|
+ {:else}
|
|
|
+ <Copy size={14} strokeWidth={2} />
|
|
|
+ {/if}
|
|
|
+</Button>
|