mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Basic page structure no routing
This commit is contained in:
parent
ab019ea072
commit
24fd30af8b
@ -17,4 +17,5 @@ pub enum AppRoutes {
|
|||||||
Plan,
|
Plan,
|
||||||
Inventory,
|
Inventory,
|
||||||
Cook,
|
Cook,
|
||||||
|
Recipe(usize),
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,12 @@ use crate::app_state::AppRoutes;
|
|||||||
mod cook;
|
mod cook;
|
||||||
mod inventory;
|
mod inventory;
|
||||||
mod plan;
|
mod plan;
|
||||||
|
mod recipe;
|
||||||
|
|
||||||
pub use cook::*;
|
pub use cook::*;
|
||||||
pub use inventory::*;
|
pub use inventory::*;
|
||||||
pub use plan::*;
|
pub use plan::*;
|
||||||
|
pub use recipe::*;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct PageState {
|
pub struct PageState {
|
||||||
|
34
web/src/pages/recipe.rs
Normal file
34
web/src/pages/recipe.rs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright 2022 Jeremy Wall (jeremy@marzhillstudios.com)
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
use crate::components::{recipe::Recipe, tabs::*};
|
||||||
|
use crate::pages::PageState;
|
||||||
|
|
||||||
|
use sycamore::prelude::*;
|
||||||
|
|
||||||
|
pub struct RecipePageProps {
|
||||||
|
pub page_state: PageState,
|
||||||
|
pub recipe: Signal<usize>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[component(RecipePage<G>)]
|
||||||
|
pub fn recipe_page(props: RecipePageProps) -> View<G> {
|
||||||
|
view! {
|
||||||
|
TabbedView(TabState {
|
||||||
|
route: props.page_state.route.clone(),
|
||||||
|
inner: view! {
|
||||||
|
Recipe(props.recipe.handle())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,9 @@ fn route_switch<G: Html>(page_state: PageState) -> View<G> {
|
|||||||
AppRoutes::Cook => view! {
|
AppRoutes::Cook => view! {
|
||||||
CookPage(CookPageProps { page_state: page_state.clone() })
|
CookPage(CookPageProps { page_state: page_state.clone() })
|
||||||
},
|
},
|
||||||
|
AppRoutes::Recipe(idx) => view! {
|
||||||
|
RecipePage(RecipePageProps { page_state: page_state.clone(), recipe: Signal::new(*idx) })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user