30 lines
811 B
Vue
30 lines
811 B
Vue
<template>
|
|
<div>
|
|
<FieldLabel>{{ label }}</FieldLabel>
|
|
<div class="mt-1 flex items-center gap-2">
|
|
<p class="break-all font-mono text-sm text-text">{{ value }}</p>
|
|
<button
|
|
type="button"
|
|
class="shrink-0 text-muted transition-colors hover:text-accent"
|
|
:title="`${label} kopieren`"
|
|
@click="copy"
|
|
>
|
|
<span class="material-symbols-outlined !text-[16px]">{{ copied ? 'check' : 'content_copy' }}</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from 'vue'
|
|
|
|
const props = defineProps<{ label: string; value: string }>()
|
|
const copied = ref(false)
|
|
|
|
async function copy() {
|
|
await navigator.clipboard.writeText(props.value)
|
|
copied.value = true
|
|
setTimeout(() => { copied.value = false }, 1500)
|
|
}
|
|
</script>
|