diff options
Diffstat (limited to 'src/components/navigation_menu/menu_items.rs')
-rw-r--r-- | src/components/navigation_menu/menu_items.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/components/navigation_menu/menu_items.rs b/src/components/navigation_menu/menu_items.rs index efab75e..f3e33b3 100644 --- a/src/components/navigation_menu/menu_items.rs +++ b/src/components/navigation_menu/menu_items.rs @@ -16,17 +16,33 @@ */ use yew::prelude::*; +use yew_icons::{IconId}; + +use crate::app::Route; +use crate::components::navigation_menu::menu_item; + +#[derive(PartialEq)] +pub struct Item { + pub label: String, + pub icon: IconId, + pub to: Route, +} #[derive(Properties, PartialEq)] pub struct Props { - pub children: Children, + pub items: Vec<Item>, } #[function_component(MenuItems)] pub fn menu_items(props: &Props) -> Html { + let menu_items: Html = props.items + .iter() + .map(|item| html!(<menu_item::MenuItem icon={item.icon} label={item.label.clone()} to={item.to.clone()} />)) + .collect(); + html! { <div class={"items-wrapper"}> - {props.children.clone()} + {menu_items} </div> } } |