use crate::utils::mount_style::mount_style; use leptos::*; use leptos_icons::*; use stylers::style_sheet_str; use web_sys::MouseEvent; #[component] pub fn NavBar( cx: Scope, #[prop(optional, into)] title: MaybeSignal, #[prop(optional, into)] left_arrow: MaybeSignal, #[prop(optional, into)] left_text: MaybeSignal, #[prop(optional, into)] click_left: Option>, #[prop(optional, into)] right_text: MaybeSignal, #[prop(optional, into)] click_right: Option>, ) -> impl IntoView { let class_name = mount_style("nav-bar", || style_sheet_str!("./src/mobile/nav_bar/nav-bar.css")); let onclick_left = move |ev| { if let Some(click_left) = click_left { click_left.set(ev); } }; let onclick_right = move |ev| { if let Some(click_right) = click_right { click_right.set(ev); } }; view! { cx, class=class_name,
{ move || { let left_text = left_text.get(); if left_arrow.get() || !left_text.is_empty() { view! { cx, class=class_name,
{ if left_arrow.get() { view! { cx, }.into() } else { None } } { left_text }
}.into() } else { None } } }
{ move || title.get() }
{ move || { let right_text = right_text.get(); if !right_text.is_empty() { view! { cx, class=class_name,
{ right_text }
}.into() } else { None } } }
} }