use leptos::prelude::*; use leptos_router::hooks::use_navigate; use leptos_icons::Icon; /// # Banner Component /// /// This component displays a red banner at the top of the page with a title and a logo. /// Clicking the logo will redirect a user to specified page, preferably a home page. /// /// Example usage: /// ``` /// /// ``` #[component] pub fn Banner( /// The title of the banner. #[prop(into)] title: String, /// The file path or URL of a logo displayed at the top left of the banner. #[prop(into)] logo: Signal, /// The route that the navigates user to a page (home page). #[prop(into, optional)] path: Signal, ) -> impl IntoView { let navigate = use_navigate(); let show_back = Signal::derive(move || !path.get().is_empty()); let on_click = move |_| { let path = path.get(); if !path.is_empty() { navigate(&path, Default::default()); } }; view! {
icon

{title.clone()}

} }