mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Fix reciper view rendering
This commit is contained in:
parent
3dc8461547
commit
3f1e79b001
@ -133,7 +133,7 @@ pub fn Editor<'ctx, G: Html>(cx: Scope<'ctx>, props: RecipeComponentProps<'ctx>)
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn Steps<G: Html>(cx: Scope, steps: Vec<recipes::Step>) -> View<G> {
|
fn Steps<G: Html>(cx: Scope, steps: Vec<recipes::Step>) -> View<G> {
|
||||||
let step_fragments = View::new_fragment(steps.iter().map(|step| {
|
let step_fragments = View::new_fragment(steps.iter().enumerate().map(|(idx, step)| {
|
||||||
let mut step = step.clone();
|
let mut step = step.clone();
|
||||||
let ingredient_fragments = View::new_fragment(step.ingredients.drain(0..).map(|i| {
|
let ingredient_fragments = View::new_fragment(step.ingredients.drain(0..).map(|i| {
|
||||||
view! {cx,
|
view! {cx,
|
||||||
@ -144,7 +144,7 @@ fn Steps<G: Html>(cx: Scope, steps: Vec<recipes::Step>) -> View<G> {
|
|||||||
}).collect());
|
}).collect());
|
||||||
view! {cx,
|
view! {cx,
|
||||||
div {
|
div {
|
||||||
h3 { "Instructions" }
|
h3 { "Step " (idx + 1) }
|
||||||
ul(class="ingredients") {
|
ul(class="ingredients") {
|
||||||
(ingredient_fragments)
|
(ingredient_fragments)
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ fn Steps<G: Html>(cx: Scope, steps: Vec<recipes::Step>) -> View<G> {
|
|||||||
}
|
}
|
||||||
}).collect());
|
}).collect());
|
||||||
view! {cx,
|
view! {cx,
|
||||||
h2 { "Steps: " }
|
h2 { "Instructions: " }
|
||||||
div(class="recipe_steps") {
|
div(class="recipe_steps") {
|
||||||
(step_fragments)
|
(step_fragments)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user