mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Add CopyValue
This commit is contained in:
parent
79dde724df
commit
dadc93b28a
18
src/partials/CopyValue.svelte
Normal file
18
src/partials/CopyValue.svelte
Normal file
@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
import {copyToClipboard} from "src/util/html"
|
||||
import {toast} from "src/app/ui"
|
||||
|
||||
export let label
|
||||
export let value
|
||||
|
||||
const copy = () => {
|
||||
copyToClipboard(value)
|
||||
toast.show("info", `${label} copied to clipboard!`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<strong>{label}</strong>
|
||||
<div class="flex items-center gap-2 font-mono text-sm">
|
||||
<i class="fa-solid fa-copy cursor-pointer" on:click={copy} />
|
||||
{value.length > 80 ? value.slice(0, 50) + "..." : value}
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user