mentorenwahl/frontend/src/layouts/main.rs

44 lines
1009 B
Rust

use yew::prelude::*;
use crate::components;
pub enum Msg {
LogOutClicked,
LogOut(Option<Vec<String>>),
}
#[derive(Properties, PartialEq)]
pub struct MainProps {
pub token: Option<String>,
pub logged_in: bool,
#[prop_or_default]
pub children: Children,
}
pub struct Main;
impl Component for Main {
type Message = Msg;
type Properties = MainProps;
fn create(_ctx: &Context<Self>) -> Self {
Self
}
fn view(&self, ctx: &Context<Self>) -> Html {
html! {
<>
<components::logged_in_handler::LoggedInHandler logged_in={ctx.props().logged_in} />
<div id="wrapper">
<components::navbar::Navbar token={ctx.props().token.to_owned()} logged_in={ctx.props().logged_in} />
<main>
{ for ctx.props().children.iter() }
</main>
</div>
<components::footer::Footer />
</>
}
}
}