mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Co-authored-by: Brandon Oxendine <brandon.oxendine@gmail.com> Signed-off-by: Brandon Oxendine <brandon.oxendine@gmail.com> Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
48 lines
967 B
Svelte
48 lines
967 B
Svelte
<script lang="ts">
|
|
import Icon from "@app/Icon.svelte";
|
|
import { toClipboard } from "@app/utils";
|
|
import { createEventDispatcher } from "svelte";
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
const copy = () => {
|
|
toClipboard(text);
|
|
dispatch("copied");
|
|
};
|
|
|
|
export let text: string;
|
|
export let small = false;
|
|
</script>
|
|
|
|
<style>
|
|
.clipboard {
|
|
width: 2rem;
|
|
height: 2rem;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
.clipboard.small {
|
|
width: 1.5rem;
|
|
height: 1.5rem;
|
|
}
|
|
.clipboard:hover :global(svg) {
|
|
fill: var(--color-foreground);
|
|
}
|
|
.clipboard:active :global(svg) {
|
|
fill: var(--color-foreground-6);
|
|
}
|
|
.clipboard:hover {
|
|
border-radius: var(--border-radius);
|
|
}
|
|
</style>
|
|
|
|
<span class="clipboard" class:small on:click|stopPropagation={copy}>
|
|
{#if small}
|
|
<Icon name="clipboard-small" />
|
|
{:else}
|
|
<Icon name="clipboard" />
|
|
{/if}
|
|
</span>
|