Add ingredients in the side of instructions. Quite messy...
This commit is contained in:
parent
4ca32453e2
commit
ab068ee898
17
src/components/Detail/StepIngredientSideView.astro
Normal file
17
src/components/Detail/StepIngredientSideView.astro
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
import client from "@/data/pocketbase";
|
||||||
|
|
||||||
|
const { ingredients, class: className } = Astro.props;
|
||||||
|
|
||||||
|
const ings = await Promise.all(
|
||||||
|
ingredients.map(async i => await client.collection("ingredients").getOne(i))
|
||||||
|
)
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class={className}>
|
||||||
|
{ings.map(i => (
|
||||||
|
<div>
|
||||||
|
<p>• {i.quantity} {i.unit || " "} {i.name}</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
@ -1,13 +1,25 @@
|
|||||||
---
|
---
|
||||||
|
import { record } from "astro:schema"
|
||||||
|
import client from "@/data/pocketbase"
|
||||||
|
import StepIngredientSideView from "./StepIngredientSideView.astro"
|
||||||
|
|
||||||
const { steps } = Astro.props
|
const { steps } = Astro.props
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="md:ml-5 mt-2 md:mt-0">
|
<div class="md:ml-5 mt-2 md:mt-0">
|
||||||
<p class="text-[22pt] font-bold md:hidden">Steps</p>
|
<p class="text-[22pt] font-bold md:hidden">Steps</p>
|
||||||
{ steps.map(s => (
|
{ steps.map(s => (
|
||||||
<div class="bg-[#2a2b2c] rounded-lg mb-2 p-3 md:">
|
<div class="bg-[#2a2b2c] rounded-lg mb-2 p-3">
|
||||||
<p class="text-bold text-[10pt]">Step {s.index + 1}</p>
|
<p class="text-bold text-[10pt]">Step {s.index + 1}</p>
|
||||||
<p>{s.instruction}</p>
|
|
||||||
|
<div class="flex flex-col md:flex-row md:items-stretch">
|
||||||
|
<p class="w-full md:flex-2/3 pr-1 text-left">{s.instruction}</p>
|
||||||
|
{s.ingredients && s.ingredients.length > 0 && (
|
||||||
|
<div class="w-full md:w-auto md:flex-1/3 mt-2 md:mt-0 md:ml-2 md:pl-3 md:border-l text-white/70 border-white/70">
|
||||||
|
<StepIngredientSideView class="text-left" ingredients={s.ingredients} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)) }
|
)) }
|
||||||
</div>
|
</div>
|
Loading…
x
Reference in New Issue
Block a user