mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
25 lines
573 B
Svelte
25 lines
573 B
Svelte
<script lang="ts">
|
|
import { addNotification } from '$lib/stores/notifications';
|
|
|
|
export let value: string;
|
|
|
|
const copy = async () => {
|
|
try {
|
|
await navigator.clipboard.writeText(value);
|
|
addNotification({
|
|
message: 'Copied to clipboard.',
|
|
type: 'success'
|
|
});
|
|
} catch (error) {
|
|
addNotification({
|
|
message: error.message,
|
|
type: 'error'
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<span on:click|preventDefault={copy}>
|
|
<slot />
|
|
</span>
|