use crate::hooks::use_user_context; use crate::Route; use ybc::NavbarFixed::Top; use yew::prelude::*; use yew_hooks::prelude::*; use yew_router::prelude::*; #[derive(PartialEq, Properties)] pub struct Props { pub children: Children, } #[function_component] pub fn BasePage(props: &Props) -> Html { let navigator = use_navigator().unwrap(); let user_ctx = use_user_context(); let node = use_node_ref(); let size = use_size(node.clone()); let authenticated = user_ctx.is_authenticated(); let title = if authenticated { html! {"Photos"} } else { html! {"No photos"} }; let navbrand = html! { {title} }; let account_button = if authenticated { let onclick = { Callback::from(move |_| { user_ctx.logout(); }) }; html! { {"logout"} } } else { let onclick = Callback::from(move |_| navigator.push(&Route::Login)); html! { {"login"} } }; let navstart = html! {}; let navend = html! { <> // // // {"Photos"} // // {account_button} }; html! { <>
{ props.children.clone() }
} }