mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-20 22:00:43 +08:00
52 lines
925 B
Svelte
52 lines
925 B
Svelte
<script lang="ts">
|
|
import { parseRadicleId, toClipboard } from "@app/utils";
|
|
|
|
export let urn: string;
|
|
|
|
let copied = false;
|
|
|
|
const copy = () => {
|
|
return () =>
|
|
toClipboard(urn).then(() => {
|
|
copied = true;
|
|
setTimeout(() => {
|
|
copied = false;
|
|
}, 3000);
|
|
});
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.urn {
|
|
display: inline-flex;
|
|
font-size: 1rem;
|
|
line-height: 2rem;
|
|
color: var(--color-foreground-90);
|
|
vertical-align: middle;
|
|
}
|
|
.icon {
|
|
width: 1rem;
|
|
margin-right: 0.5rem;
|
|
}
|
|
.urn > * {
|
|
vertical-align: middle;
|
|
}
|
|
</style>
|
|
|
|
<div class="desktop">
|
|
<div class="urn">
|
|
<span class="icon">🌱</span>
|
|
<span class="faded">rad:git:</span>
|
|
<span>{parseRadicleId(urn)}</span>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<button class="small faded" disabled={copied} on:click={copy()}>
|
|
{#if copied}
|
|
Copy ✓
|
|
{:else}
|
|
Copy
|
|
{/if}
|
|
</button>
|
|
</div>
|