Skip to content

Commit

Permalink
Merge pull request #215 from ninoseki/add-copy-to-clipboard
Browse files Browse the repository at this point in the history
feat: add copy-to-clipboard dropdown item
  • Loading branch information
ninoseki authored Feb 28, 2024
2 parents 6e0ca68 + 391dd8d commit a99a98e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
16 changes: 15 additions & 1 deletion frontend/src/components/IndicatorButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
</div>
<div class="dropdown-menu">
<div class="dropdown-content">
<div class="dropdown-item">
<button class="button is-borderless is-small" @click="copyToClipboard">
<span class="icon">
<font-awesome-icon icon="copy"></font-awesome-icon>
</span>
<span>Copy to clipboard</span>
</button>
</div>
<div class="dropdown-item" v-for="(link, index) in links" :key="index">
<a :href="link.href(value)" class="button is-borderless is-small" target="_blank">
<span class="icon">
Expand All @@ -24,6 +32,7 @@
</template>

<script lang="ts">
import { useClipboard } from '@vueuse/core'
import truncate from 'just-truncate'
import { computed, defineComponent } from 'vue'
Expand All @@ -48,7 +57,12 @@ export default defineComponent({
return Links.filter((link) => link.type === indicatorType.value)
})
return { truncate, links, indicatorType }
const copyToClipboard = () => {
const { copy } = useClipboard()
copy(props.value)
}
return { truncate, links, indicatorType, copyToClipboard }
}
})
</script>
13 changes: 12 additions & 1 deletion frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'font-awesome-animation/css/font-awesome-animation.min.css'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faAngleDown,
faCopy,
faDownload,
faInfoCircle,
faLink,
Expand All @@ -17,7 +18,17 @@ import { createApp } from 'vue'

import router from '@/router'

library.add(faAngleDown, faLink, faSearch, faUpload, faSpinner, faDownload, faUpload, faInfoCircle)
library.add(
faAngleDown,
faLink,
faSearch,
faUpload,
faSpinner,
faDownload,
faUpload,
faInfoCircle,
faCopy
)

import App from '@/App.vue'

Expand Down

0 comments on commit a99a98e

Please sign in to comment.