From 119f64b29c0147f86f63e18e14818c41e4bdefdd Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 30 Aug 2023 09:59:52 +0530 Subject: populating menu from a vector now --- src/components/navigation_menu/menu_items.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/components/navigation_menu') 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, } #[function_component(MenuItems)] pub fn menu_items(props: &Props) -> Html { + let menu_items: Html = props.items + .iter() + .map(|item| html!()) + .collect(); + html! {
- {props.children.clone()} + {menu_items}
} } -- cgit v1.2.3