File size: 349 Bytes
8766bc5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <script lang="ts">
import { BaseButton } from "@gradio/button/static";
export let code: string;
let copy_text = "copy";
function copy(): void {
navigator.clipboard.writeText(code);
copy_text = "copied!";
setTimeout(() => {
copy_text = "copy";
}, 1500);
}
</script>
<BaseButton size="sm" on:click={copy}>
{copy_text}
</BaseButton>
|