mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-12 13:26:45 +00:00
use shared component for the recipe
This commit is contained in:
parent
98888fd814
commit
a567a4c41a
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-if="pending">Loading</div>
|
||||||
<div v-else-if="error">Failed: {{ error }}</div>
|
<div v-else-if="error">Failed: {{ error }}</div>
|
||||||
<section v-else>
|
<section v-else>
|
||||||
<div class="lg:flex space-y-4 lg:justify-evenly py-4">
|
<Recipe :recipe="recipe" />
|
||||||
<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>
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,4 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
definePageMeta({
|
|
||||||
pageTransition: {
|
|
||||||
name: "custom-flip",
|
|
||||||
mode: "out-in",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const { recipe, pending, error } = await useRecipe("random");
|
const { recipe, pending, error } = await useRecipe("random");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -12,22 +6,6 @@ const { recipe, pending, error } = await useRecipe("random");
|
||||||
<div v-if="pending">Loading</div>
|
<div v-if="pending">Loading</div>
|
||||||
<div v-else-if="error">Failed: {{ error }}</div>
|
<div v-else-if="error">Failed: {{ error }}</div>
|
||||||
<section v-else>
|
<section v-else>
|
||||||
<div class="lg:flex space-y-4 lg:justify-evenly py-4">
|
<Recipe :recipe="recipe" />
|
||||||
<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>
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue