mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-16 10:03:54 -07:00
feat: redesign recipe info card (#5026)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
parent
3fd3661206
commit
3b0d6050a2
7 changed files with 96 additions and 106 deletions
|
@ -1,41 +1,33 @@
|
|||
<template>
|
||||
<div v-if="stacked">
|
||||
<v-container>
|
||||
<v-row v-for="(time, index) in allTimes" :key="`${index}-stacked`" no-gutters>
|
||||
<v-col cols="12" :class="containerClass">
|
||||
<v-chip
|
||||
:small="$vuetify.breakpoint.smAndDown"
|
||||
label
|
||||
:color="color"
|
||||
class="ma-1"
|
||||
>
|
||||
<v-icon left>
|
||||
{{ $globals.icons.clockOutline }}
|
||||
</v-icon>
|
||||
{{ time.name }} |
|
||||
{{ time.value }}
|
||||
</v-chip>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</div>
|
||||
<div v-else>
|
||||
<v-container :class="containerClass">
|
||||
<v-chip
|
||||
v-for="(time, index) in allTimes"
|
||||
:key="index"
|
||||
:small="$vuetify.breakpoint.smAndDown"
|
||||
label
|
||||
:color="color"
|
||||
class="ma-1"
|
||||
>
|
||||
<v-icon left>
|
||||
<template v-if="showCards">
|
||||
<div class="text-center">
|
||||
<!-- Total Time -->
|
||||
<div v-if="validateTotalTime" class="time-card-flex mx-auto">
|
||||
<v-row no-gutters class="d-flex flex-no-wrap align-center " :style="fontSize">
|
||||
<v-icon :x-large="!small" left color="primary">
|
||||
{{ $globals.icons.clockOutline }}
|
||||
</v-icon>
|
||||
{{ time.name }} |
|
||||
{{ time.value }}
|
||||
</v-chip>
|
||||
</v-container>
|
||||
<p class="my-0"><span class="font-weight-bold">{{ validateTotalTime.name }}</span><br>{{ validateTotalTime.value }}</p>
|
||||
</v-row>
|
||||
</div>
|
||||
<v-divider v-if="validateTotalTime && (validatePrepTime || validatePerformTime)" class="my-2" />
|
||||
<!-- Prep Time & Perform Time -->
|
||||
<div v-if="validatePrepTime || validatePerformTime" class="time-card-flex mx-auto">
|
||||
<v-row no-gutters class="d-flex justify-center align-center" style="width: 100%;" :style="fontSize">
|
||||
<div v-if="validatePrepTime" class="d-flex flex-no-wrap">
|
||||
<v-icon :large="!small" :dense="small" left color="primary">
|
||||
{{ $globals.icons.knfife }}
|
||||
</v-icon>
|
||||
<p class="my-0"><span class="font-weight-bold">{{ validatePrepTime.name }}</span><br>{{ validatePrepTime.value }}</p>
|
||||
</div>
|
||||
<v-divider v-if="validatePrepTime && validatePerformTime" vertical class="mx-4" />
|
||||
<div v-if="validatePerformTime" class="d-flex flex-no-wrap">
|
||||
<v-icon :large="!small" :dense="small" left color="primary">
|
||||
{{ $globals.icons.potSteam }}
|
||||
</v-icon>
|
||||
<p class="my-0"><span class="font-weight-bold">{{ validatePerformTime.name }}</span><br>{{ validatePerformTime.value }}</p>
|
||||
</div>
|
||||
</v-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -44,10 +36,6 @@ import { computed, defineComponent, useContext } from "@nuxtjs/composition-api";
|
|||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
stacked: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
prepTime: {
|
||||
type: String,
|
||||
default: null,
|
||||
|
@ -64,9 +52,9 @@ export default defineComponent({
|
|||
type: String,
|
||||
default: "accent custom-transparent"
|
||||
},
|
||||
containerClass: {
|
||||
type: String,
|
||||
default: undefined,
|
||||
small: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
|
@ -92,13 +80,16 @@ export default defineComponent({
|
|||
return !isEmpty(props.performTime) ? { name: i18n.t("recipe.perform-time"), value: props.performTime } : null;
|
||||
});
|
||||
|
||||
const allTimes = computed(() => {
|
||||
return [validateTotalTime.value, validatePrepTime.value, validatePerformTime.value].filter((x) => x !== null);
|
||||
const fontSize = computed(() => {
|
||||
return props.small ? { fontSize: "smaller" } : { fontSize: "larger" };
|
||||
});
|
||||
|
||||
return {
|
||||
showCards,
|
||||
allTimes,
|
||||
validateTotalTime,
|
||||
validatePrepTime,
|
||||
validatePerformTime,
|
||||
fontSize,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue