Move the copy button to a standalone component

This commit is contained in:
Bubka
2024-01-19 17:06:16 +01:00
parent 342448b352
commit 5249b2ab97
2 changed files with 25 additions and 17 deletions

View File

@ -0,0 +1,21 @@
<script setup>
import { useNotifyStore } from '@/stores/notify'
const notify = useNotifyStore()
const { copy } = useClipboard({ legacy: true })
const props = defineProps({
token: String,
})
function copyToClipboard() {
copy(props.token)
notify.success({ text: trans('commons.copied_to_clipboard') })
}
</script>
<template>
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" @click.stop="copyToClipboard()">
<FontAwesomeIcon :icon="['fas', 'copy']" />
</button>
</template>