1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

feat: improve readability of ingredients list (#2502)

* feat: improve readability of notes in ingredients list

Makes the notes in the ingredients list more readable by making them slightly opaque. This creates a better visual separation between the notes and the rest of the ingredient.

* Use server display if available

* Move note to newline and make quantity more distinct

* Use safeMarkdown for shopping list

* Use component

* Wrap unit in accent color

* Update RecipeIngredientListItem to set food in bold
This commit is contained in:
Hugo van Rijswijk 2023-08-21 17:32:09 +02:00 committed by GitHub
parent 2151451634
commit 50a92c165c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 140 additions and 25 deletions

View file

@ -11,7 +11,7 @@
<v-list-item dense @click="toggleChecked(index)">
<v-checkbox hide-details :value="checked[index]" class="pt-0 my-auto py-auto" color="secondary" />
<v-list-item-content :key="ingredient.quantity">
<SafeMarkdown class="ma-0 pa-0 text-subtitle-1 dense-markdown" :source="ingredientDisplay[index]" />
<RecipeIngredientListItem :ingredient="ingredient" :disable-amount="disableAmount" :scale="scale" />
</v-list-item-content>
</v-list-item>
</div>
@ -21,12 +21,12 @@
<script lang="ts">
import { computed, defineComponent, reactive, toRefs } from "@nuxtjs/composition-api";
// @ts-ignore vue-markdown has no types
import RecipeIngredientListItem from "./RecipeIngredientListItem.vue";
import { parseIngredientText } from "~/composables/recipes";
import { RecipeIngredient } from "~/lib/api/types/recipe";
export default defineComponent({
components: {},
components: { RecipeIngredientListItem },
props: {
value: {
type: Array as () => RecipeIngredient[],
@ -52,7 +52,11 @@ export default defineComponent({
});
const ingredientCopyText = computed(() => {
return ingredientDisplay.value.join("\n");
return props.value
.map((ingredient) => {
return `${parseIngredientText(ingredient, props.disableAmount, props.scale)}`;
})
.join("\n");
});
function toggleChecked(index: number) {
@ -61,16 +65,8 @@ export default defineComponent({
state.checked.splice(index, 1, !state.checked[index]);
}
const ingredientDisplay = computed(() => {
return props.value.map((ingredient) => {
return `${parseIngredientText(ingredient, props.disableAmount, props.scale)}`;
});
});
return {
ingredientDisplay,
...toRefs(state),
parseIngredientText,
ingredientCopyText,
toggleChecked,
};