mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-06 02:26:49 +00:00
use shared component for the recipe
This commit is contained in:
parent
07d3a8d864
commit
6df97a0113
3 changed files with 29 additions and 40 deletions
27
components/recipe/index.vue
Normal file
27
components/recipe/index.vue
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
recipe: Recipe;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="lg:flex space-y-4 lg:justify-evenly py-4">
|
||||
<div class="card w-96 bg-base-100 shadow-xl mx-auto lg:mx-2 min-h-32">
|
||||
<RecipeCard
|
||||
:title="recipe.title"
|
||||
:picture-url="recipe.pictureUrl"
|
||||
:video-url="recipe.videoUrl"
|
||||
:category="recipe.category"
|
||||
:origin="recipe.origin"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<RecipeIngredients :ingredients="recipe.ingredients" />
|
||||
</div>
|
||||
<div class="flex flex-col items-center p-4">
|
||||
<h2 class="prose lg:prose-xl">Instructions</h2>
|
||||
<p class="prose">{{ recipe.instructions }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -7,22 +7,6 @@ const { recipe, pending, error } = await useRecipe("lookup", params.id);
|
|||
<div v-if="pending">Loading</div>
|
||||
<div v-else-if="error">Failed: {{ error }}</div>
|
||||
<section v-else>
|
||||
<div class="lg:flex space-y-4 lg:justify-evenly py-4">
|
||||
<div class="card w-96 bg-base-100 shadow-xl mx-auto lg:mx-2 min-h-32">
|
||||
<RecipeCard
|
||||
:title="recipe.title"
|
||||
:picture-url="recipe.pictureUrl"
|
||||
:video-url="recipe.videoUrl"
|
||||
:category="recipe.category"
|
||||
:origin="recipe.origin"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<RecipeIngredients :ingredients="recipe.ingredients" />
|
||||
</div>
|
||||
<div class="flex flex-col items-center">
|
||||
<h2 class="prose lg:prose-xl">Instructions</h2>
|
||||
<p class="prose">{{ recipe.instructions }}</p>
|
||||
</div>
|
||||
<Recipe :recipe="recipe" />
|
||||
</section>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
pageTransition: {
|
||||
name: "custom-flip",
|
||||
mode: "out-in",
|
||||
},
|
||||
});
|
||||
const { recipe, pending, error } = await useRecipe("random");
|
||||
</script>
|
||||
|
||||
|
|
@ -12,22 +6,6 @@ const { recipe, pending, error } = await useRecipe("random");
|
|||
<div v-if="pending">Loading</div>
|
||||
<div v-else-if="error">Failed: {{ error }}</div>
|
||||
<section v-else>
|
||||
<div class="lg:flex space-y-4 lg:justify-evenly py-4">
|
||||
<div class="card w-96 bg-base-100 shadow-xl mx-auto lg:mx-2 min-h-32">
|
||||
<RecipeCard
|
||||
:title="recipe.title"
|
||||
:picture-url="recipe.pictureUrl"
|
||||
:video-url="recipe.videoUrl"
|
||||
:category="recipe.category"
|
||||
:origin="recipe.origin"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<RecipeIngredients :ingredients="recipe.ingredients" />
|
||||
</div>
|
||||
<div class="flex flex-col items-center p-4">
|
||||
<h2 class="prose lg:prose-xl">Instructions</h2>
|
||||
<p class="prose">{{ recipe.instructions }}</p>
|
||||
</div>
|
||||
<Recipe :recipe="recipe" />
|
||||
</section>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in a new issue