use yew::{function_component, html, use_state_eq, Callback, Html, Properties}; #[derive(Properties, PartialEq)] pub struct TabPanelProps { pub tabs: Vec<(char, Html)>, } #[function_component(TabPanel)] pub fn tab_panel_props(props: &TabPanelProps) -> Html { let active_tab = use_state_eq(|| props.tabs.first().map(|(k, _)| *k).unwrap_or('0')); html! {
{props.tabs.iter().map(|(c, v)| { let class_name = if *c == *active_tab { "termtreewrapper"} else { "d-none"}; html! {
{v.clone()}
} }).collect::>()}
} }