Added tooltips to dropdown icons

#524
This commit is contained in:
Donald Zou 2024-11-26 22:43:33 +08:00
parent b4f3fb3b30
commit c9d78e3f67
2 changed files with 72 additions and 16 deletions

View File

@ -2,10 +2,12 @@
import {fetchGet, fetchPost} from "@/utilities/fetch.js"; import {fetchGet, fetchPost} from "@/utilities/fetch.js";
import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js"; import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js";
import LocaleText from "@/components/text/localeText.vue"; import LocaleText from "@/components/text/localeText.vue";
import PeerSettingsDropdownTool
from "@/components/configurationComponents/peerSettingsDropdownComponents/peerSettingsDropdownTool.vue";
export default { export default {
name: "peerSettingsDropdown", name: "peerSettingsDropdown",
components: {LocaleText}, components: {PeerSettingsDropdownTool, LocaleText},
setup(){ setup(){
const dashboardStore = DashboardConfigurationStore() const dashboardStore = DashboardConfigurationStore()
return {dashboardStore} return {dashboardStore}
@ -110,21 +112,38 @@ export default {
</li> </li>
</template> </template>
<template v-else> <template v-else>
<li class="d-flex" style="padding-left: var(--bs-dropdown-item-padding-x); padding-right: var(--bs-dropdown-item-padding-x);"> <li>
<a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.downloadPeer()"> <div class="text-center text-muted">
<i class="me-auto bi bi-download"></i>
</a> </div>
<a class="dropdown-item text-center px-0 rounded-3" role="button" <div class="d-flex" style="padding-left: var(--bs-dropdown-item-padding-x); padding-right: var(--bs-dropdown-item-padding-x);">
@click="this.downloadQRCode('qrcode')"> <!-- <a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.downloadPeer()">-->
<i class="me-auto bi bi-qr-code"></i> <!-- <i class="me-auto bi bi-download"></i>-->
</a> <!-- </a>-->
<a class="dropdown-item text-center px-0 rounded-3" role="button" <!-- <a class="dropdown-item text-center px-0 rounded-3" role="button"-->
@click="this.downloadQRCode('configurationFile')"> <!-- @click="this.downloadQRCode('qrcode')">-->
<i class="me-auto bi bi-body-text"></i> <!-- <i class="me-auto bi bi-qr-code"></i>-->
</a> <!-- </a>-->
<a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.$emit('share')"> <!-- <a class="dropdown-item text-center px-0 rounded-3" role="button"-->
<i class="me-auto bi bi-share"></i> <!-- @click="this.downloadQRCode('configurationFile')">-->
</a> <!-- <i class="me-auto bi bi-body-text"></i>-->
<!-- </a>-->
<!-- <a class="dropdown-item text-center px-0 rounded-3" role="button" @click="this.$emit('share')">-->
<!-- <i class="me-auto bi bi-share"></i>-->
<!-- </a>-->
<PeerSettingsDropdownTool icon="bi-download"
title="Download"
@click="this.downloadPeer()"></PeerSettingsDropdownTool>
<PeerSettingsDropdownTool icon="bi-qr-code"
title="QR Code"
@click="this.downloadQRCode('qrcode')"></PeerSettingsDropdownTool>
<PeerSettingsDropdownTool icon="bi-body-text"
title="Configuration File"
@click="this.downloadQRCode('configurationFile')"></PeerSettingsDropdownTool>
<PeerSettingsDropdownTool icon="bi-share"
title="Share"
@click="this.$emit('share')"></PeerSettingsDropdownTool>
</div>
</li> </li>
</template> </template>
<li><hr class="dropdown-divider"></li> <li><hr class="dropdown-divider"></li>

View File

@ -0,0 +1,37 @@
<script setup>
import {ref} from "vue";
const props = defineProps({
icon: String,
title: String
})
const emit = defineEmits(["click"])
const show = ref(false)
</script>
<template>
<a class="dropdown-item text-center px-0 rounded-3 position-relative" role="button"
@mouseenter="show = true"
@mouseleave="show = false"
@click="emit('click')">
<i class="me-auto bi" :class="icon"></i>
<Transition name="zoomReversed">
<span
v-if="show"
class="position-absolute d-block p-1 px-2 bg-body text-body rounded-3 border shadow">
<small>
{{title}}
</small>
</span>
</Transition>
</a>
</template>
<style scoped>
span{
top: -34px;
left: 0;
}
</style>