diff --git a/app/src/main.rs b/app/src/main.rs index 20617a7..1d0cda5 100644 --- a/app/src/main.rs +++ b/app/src/main.rs @@ -6,6 +6,10 @@ use web_sys::HtmlInputElement; use yew::prelude::*; use yew_router::prelude::*; +use crate::sidebar::RegaladeSidebar; + +mod sidebar; + #[derive(Routable, Debug, Clone, Copy, PartialEq, Eq)] enum Route { #[at("/")] diff --git a/app/src/sidebar.rs b/app/src/sidebar.rs new file mode 100644 index 0000000..657d6f2 --- /dev/null +++ b/app/src/sidebar.rs @@ -0,0 +1,149 @@ +use yew::prelude::*; +use crate::Route; + +#[derive(PartialEq)] +struct MenuEntry { + icon: &'static str, + label: &'static str, + page: Route, +} + +#[derive(Properties, PartialEq)] +struct SidebarProps { + entries: Vec, + current: Route, + household: AttrValue, + children: Children, +} + +#[function_component] +fn Sidebar(props: &SidebarProps) -> Html { + html! { +
+
+
+
+ + {"Menu"} + +
+ +
+ +
+
+
+ { for props.children.iter() } +
+
+
+ } +} + +#[derive(Properties, PartialEq)] +pub(crate) struct RegaladeSidebarProps { + pub(crate) current: Route, + pub(crate) household: AttrValue, + pub(crate) children: Children, +} + +#[function_component] +pub(crate) fn RegaladeSidebar(props: &RegaladeSidebarProps) -> Html { + let entries = vec![ + MenuEntry { + label: "Home", + icon: "bi-house", + page: Route::Index, + }, + MenuEntry { + label: "Ingredients", + icon: "bi-egg-fill", + page: Route::Ingredients, + }, + ]; + + html! { + + { for props.children.iter() } + + } +} +