add tooltip to fab (#497)

This commit is contained in:
wengtad 2021-06-12 14:59:14 +08:00 committed by GitHub
parent e8c0a76051
commit 1209bf4b80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 30 deletions

View file

@ -17,11 +17,25 @@
:nudge-top="menuTop ? '5' : '0'"
allow-overflow
>
<template v-slot:activator="{ on, attrs }">
<v-btn :fab="fab" :small="fab" :color="color" :icon="!fab" dark v-bind="attrs" v-on="on" @click.prevent>
<template v-slot:activator="{ on: onMenu, attrs: attrsMenu }">
<v-tooltip bottom dark :color="color">
<template v-slot:activator="{ on: onTooltip, attrs: attrsTooltip }">
<v-btn
:fab="fab"
:small="fab"
:color="color"
:icon="!fab"
dark
v-bind="{ ...attrsMenu, ...attrsTooltip }"
v-on="{ ...onMenu, ...onTooltip }"
@click.prevent
>
<v-icon>{{ menuIcon }}</v-icon>
</v-btn>
</template>
<span>{{ $t("general.more") }}</span>
</v-tooltip>
</template>
<v-list dense>
<v-list-item
v-for="(item, index) in loggedIn && cardMenu ? userMenu : defaultMenu"
@ -142,7 +156,7 @@ export default {
url: this.recipeURL,
})
.then(() => console.log("Successful share"))
.catch((error) => {
.catch(error => {
console.log("WebShareAPI not supported", error);
this.updateClipboard();
});

View file

@ -1,4 +1,6 @@
<template>
<v-tooltip right :color="buttonStyle ? 'primary' : 'secondary'">
<template v-slot:activator="{ on, attrs }">
<v-btn
small
@click.prevent="toggleFavorite"
@ -6,11 +8,16 @@
:color="buttonStyle ? 'primary' : 'secondary'"
:icon="!buttonStyle"
:fab="buttonStyle"
v-bind="attrs"
v-on="on"
>
<v-icon :small="!buttonStyle" color="secondary">
{{ isFavorite ? "mdi-heart" : "mdi-heart-outline" }}
</v-icon>
</v-btn>
</template>
<span>{{ isFavorite ? $t("recipe.remove-from-favorites") : $t("recipe.add-to-favorites") }}</span>
</v-tooltip>
</template>
<script>

View file

@ -18,9 +18,14 @@
/>
<v-spacer></v-spacer>
<div v-if="!value" class="custom-btn-group ma-1">
<v-btn fab small class="mx-1" color="info" @click="$emit('input', true)">
<v-tooltip bottom color="info">
<template v-slot:activator="{ on, attrs }">
<v-btn fab small class="mx-1" color="info" v-bind="attrs" v-on="on" @click="$emit('input', true)">
<v-icon> {{ $globals.icons.edit }} </v-icon>
</v-btn>
</template>
<span>{{ $t("general.edit") }}</span>
</v-tooltip>
<ContextMenu
:menu-top="false"
:slug="slug"

View file

@ -90,12 +90,22 @@
<v-icon> {{ $globals.icons.createAlt }} </v-icon>
</v-btn>
</template>
<v-btn fab dark small color="primary" @click="addRecipe = true">
<v-tooltip left dark color="primary">
<template v-slot:activator="{ on, attrs }">
<v-btn fab dark small color="primary" v-bind="attrs" v-on="on" @click="addRecipe = true">
<v-icon>mdi-link</v-icon>
</v-btn>
<v-btn fab dark small color="accent" @click="$router.push('/new')">
</template>
<span>{{ $t("new-recipe.from-url") }}</span>
</v-tooltip>
<v-tooltip left dark color="accent">
<template v-slot:activator="{ on, attrs }">
<v-btn fab dark small color="accent" v-bind="attrs" v-on="on" @click="$router.push('/new')">
<v-icon>{{ $globals.icons.edit }}</v-icon>
</v-btn>
</template>
<span>{{ $t("general.new") }}</span>
</v-tooltip>
</v-speed-dial>
</div>
</template>
@ -160,8 +170,7 @@ export default {
this.processing = false;
},
isValidWebUrl(url) {
let regEx =
/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,256}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/gm;
let regEx = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,256}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/gm;
return regEx.test(url) ? true : "Must be a Valid URL";
},

View file

@ -117,7 +117,8 @@
"url": "URL",
"view": "View",
"wednesday": "Wednesday",
"yes": "Yes"
"yes": "Yes",
"more": "More"
},
"group": {
"are-you-sure-you-want-to-delete-the-group": "Are you sure you want to delete <b>{groupName}<b/>?",
@ -251,7 +252,9 @@
"title": "Title",
"total-time": "Total Time",
"unable-to-delete-recipe": "Unable to Delete Recipe",
"view-recipe": "View Recipe"
"view-recipe": "View Recipe",
"add-to-favorites": "Add to Favorites",
"remove-from-favorites": "Remove from Favorites"
},
"search": {
"and": "and",