front-end for lightning-to-fiat exchange at https://lnurl-pay.me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
665 B

<script>
import { Tooltip } from 'sveltestrap';
const uuid=Math.random().toString(36).replace('0.','ctc');
const canCopy = navigator.clipboard && navigator.clipboard.writeText;
export let text;
export let force = false;
const click = ()=> {
navigator.clipboard.writeText(text)
.then(()=>{
justCopied = true;
})
}
let justCopied=false;
let isOpen;
$: if (justCopied && !isOpen) justCopied = false;
</script>
{#if canCopy||force}
<slot id="{uuid}" action="{click}"/>
{#if canCopy}
<Tooltip target={uuid} bind:isOpen>
{#if justCopied}
copied!
{:else}
click to copy
{/if}
</Tooltip>
{/if}
{/if}