use super::{use_tabbar, TabbarInjectionKey}; use crate::components::*; use crate::utils::StoredMaybeSignal; use crate::{icon::*, theme::use_theme, utils::mount_style::mount_style, Theme}; use leptos::*; #[component] pub fn TabbarItem( #[prop(into)] key: MaybeSignal, #[prop(optional, into)] icon: Option, children: Children, ) -> impl IntoView { mount_style("tabbar-item", include_str!("./tabbar-item.css")); let theme = use_theme(Theme::light); let tabbar = use_tabbar(); let key: StoredMaybeSignal<_> = key.into(); let on_click = move |_| { tabbar.set(TabbarInjectionKey::new(key.get())); }; let css_vars = create_memo(move |_| { let mut css_vars = String::new(); let theme = theme.get(); let font_color = theme.common.color_primary.clone(); css_vars.push_str(&format!("--font-color-selected: {font_color};")); css_vars }); view! {
{children()}
} }