add badges to all cards

This commit is contained in:
hay-kot 2021-05-29 15:23:35 -08:00
commit 1b716b46f7
7 changed files with 30 additions and 6 deletions

View file

@ -1,6 +1,13 @@
<template> <template>
<v-btn small @click.prevent="toggleFavorite" v-if="isFavorite || showAlways" color="pink lighten-2" icon> <v-btn
<v-icon small> small
@click.prevent="toggleFavorite"
v-if="isFavorite || showAlways"
:color="isFavoite && buttonStyle ? 'secondary' : 'primary'"
:icon="!buttonStyle"
:fab="buttonStyle"
>
<v-icon :small="!buttonStyle" color="secondary">
{{ isFavorite ? "mdi-heart" : "mdi-heart-outline" }} {{ isFavorite ? "mdi-heart" : "mdi-heart-outline" }}
</v-icon> </v-icon>
</v-btn> </v-btn>
@ -17,6 +24,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
buttonStyle: {
type: Boolean,
default: false,
},
}, },
computed: { computed: {
user() { user() {

View file

@ -23,6 +23,7 @@
<v-list-item-title class=" mb-1">{{ name }} </v-list-item-title> <v-list-item-title class=" mb-1">{{ name }} </v-list-item-title>
<v-list-item-subtitle> {{ description }} </v-list-item-subtitle> <v-list-item-subtitle> {{ description }} </v-list-item-subtitle>
<div class="d-flex justify-center align-center"> <div class="d-flex justify-center align-center">
<FavoriteBadge v-if="loggedIn" :slug="slug" show-always />
<v-rating <v-rating
color="secondary" color="secondary"
class="ml-auto" class="ml-auto"
@ -42,10 +43,12 @@
</template> </template>
<script> <script>
import FavoriteBadge from "@/components/Recipe/FavoriteBadge";
import ContextMenu from "@/components/Recipe/ContextMenu"; import ContextMenu from "@/components/Recipe/ContextMenu";
import { api } from "@/api"; import { api } from "@/api";
export default { export default {
components: { components: {
FavoriteBadge,
ContextMenu, ContextMenu,
}, },
props: { props: {
@ -71,6 +74,11 @@ export default {
return api.recipes.recipeSmallImage(slug, this.image); return api.recipes.recipeSmallImage(slug, this.image);
}, },
}, },
computed: {
loggedIn() {
return this.$store.getters.getIsLoggedIn;
},
},
}; };
</script> </script>

View file

@ -3,7 +3,7 @@
<slot v-bind="{ open, close }"> </slot> <slot v-bind="{ open, close }"> </slot>
<v-dialog <v-dialog
v-model="dialog" v-model="dialog"
:width="isMobile ? undefined : '700'" :width="isMobile ? undefined : '65%'"
:height="isMobile ? undefined : '0'" :height="isMobile ? undefined : '0'"
:fullscreen="isMobile" :fullscreen="isMobile"
content-class="top-dialog" content-class="top-dialog"

View file

@ -1,5 +1,5 @@
<template> <template>
<v-progress-circular class="mx-auto" :width="size / 20" :size="size" color="primary lighten-2" indeterminate> <v-progress-circular class="mx-auto" :width="size / 50" :size="size" color="primary lighten-2" indeterminate>
<div class="text-center"> <div class="text-center">
<v-icon :size="size / 2" color="primary lighten-2"> <v-icon :size="size / 2" color="primary lighten-2">
{{ $globals.icons.primary }} {{ $globals.icons.primary }}

View file

@ -1,7 +1,7 @@
<template> <template>
<v-container> <v-container>
<CardSection <CardSection
title-icon="" title-icon="mdi-test"
v-if="siteSettings.showRecent" v-if="siteSettings.showRecent"
:title="$t('page.recent')" :title="$t('page.recent')"
:recipes="recentRecipes" :recipes="recentRecipes"

View file

@ -12,6 +12,7 @@
class="d-print-none" class="d-print-none"
:key="imageKey" :key="imageKey"
> >
<FavoriteBadge class="ma-1" button-style v-if="loggedIn" :slug="recipeDetails.slug" show-always />
<RecipeTimeCard <RecipeTimeCard
:class="isMobile ? undefined : 'force-bottom'" :class="isMobile ? undefined : 'force-bottom'"
:prepTime="recipeDetails.prepTime" :prepTime="recipeDetails.prepTime"
@ -49,6 +50,7 @@
<script> <script>
import { api } from "@/api"; import { api } from "@/api";
import FavoriteBadge from "@/components/Recipe/FavoriteBadge";
import VJsoneditor from "v-jsoneditor"; import VJsoneditor from "v-jsoneditor";
import RecipeViewer from "@/components/Recipe/RecipeViewer"; import RecipeViewer from "@/components/Recipe/RecipeViewer";
import PrintView from "@/components/Recipe/PrintView"; import PrintView from "@/components/Recipe/PrintView";
@ -68,6 +70,7 @@ export default {
RecipeTimeCard, RecipeTimeCard,
PrintView, PrintView,
NoRecipe, NoRecipe,
FavoriteBadge,
}, },
mixins: [user], mixins: [user],
inject: { inject: {
@ -127,6 +130,9 @@ export default {
}, },
computed: { computed: {
loggedIn() {
return this.$store.getters.getIsLoggedIn;
},
isMobile() { isMobile() {
return this.$vuetify.breakpoint.name === "xs"; return this.$vuetify.breakpoint.name === "xs";
}, },

File diff suppressed because one or more lines are too long