Skip to content

Commit 67952d9

Browse files
committed
add icononly option to the copytoclipboard vue component
1 parent 12f3a37 commit 67952d9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/Frontend/src/components/CopyToClipboard.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
import { Tippy, TippyComponent } from "vue-tippy";
33
import { useTemplateRef } from "vue";
44
5-
const props = defineProps<{
6-
value: string;
7-
}>();
5+
const props = defineProps({
6+
value: {
7+
type: String,
8+
required: true,
9+
},
10+
isIconOnly: {
11+
type: Boolean,
12+
default: false, // Default value
13+
},
14+
});
815
916
const tippyRef = useTemplateRef<TippyComponent | null>("tippyRef");
1017
let timeoutId: number;
@@ -19,6 +26,6 @@ async function copyToClipboard() {
1926

2027
<template>
2128
<Tippy content="Copied" ref="tippyRef" trigger="manual">
22-
<button type="button" class="btn btn-secondary btn-sm" @click="copyToClipboard"><i class="fa fa-copy"></i> Copy to clipboard</button>
29+
<button type="button" class="btn btn-secondary btn-sm" @click="copyToClipboard"><i class="fa fa-copy"></i> <span v-if="!props.isIconOnly">Copy to clipboard</span></button>
2330
</Tippy>
2431
</template>

src/Frontend/src/components/messages/HeadersView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const toggleHover = (index: number, state: boolean) => {
2121
<td class="toolbar">
2222
<div style="display: flex; align-items: center" @mouseover="toggleHover(index, true)" @mouseleave="toggleHover(index, false)">
2323
<pre>{{ header.value }}</pre>
24-
<CopyToClipboard v-if="hoverStates[index]" :value="header.value || ''" />
24+
<CopyToClipboard v-if="hoverStates[index]" :value="header.value || ''" :isIconOnly="true" />
2525
</div>
2626
</td>
2727
</tr>

0 commit comments

Comments
 (0)