Remove navbar

Signed-off-by: Trivernis <trivernis@protonmail.com>
main
Trivernis 3 years ago
parent 0a13a22d51
commit 3025dd424f

@ -1,18 +1,9 @@
use crate::pages::{About, Home}; use crate::pages::{About, Home};
use yew::prelude::*; use yew::prelude::*;
use yew_router::{prelude::*, route::Route, switch::Permissive, Switch}; use yew_router::{prelude::*, route::Route, switch::Permissive, Switch};
use yew_styles::{
navbar::{
navbar_component::{Fixed, Navbar},
navbar_container::NavbarContainer,
navbar_item::NavbarItem,
},
styles::{Palette, Style},
};
pub struct App { pub struct App {
navbar_items: Vec<bool>, _link: ComponentLink<Self>,
link: ComponentLink<Self>,
} }
#[derive(Switch, Debug, Clone)] #[derive(Switch, Debug, Clone)]
@ -25,31 +16,17 @@ pub enum AppRouter {
PageNotFound(Permissive<String>), PageNotFound(Permissive<String>),
} }
pub enum Msg { pub enum Msg {}
ChangeNavbarItem(usize),
}
impl Component for App { impl Component for App {
type Message = Msg; type Message = Msg;
type Properties = (); type Properties = ();
fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self { fn create(_: Self::Properties, _link: ComponentLink<Self>) -> Self {
App { App { _link }
navbar_items: vec![true, false],
link,
}
} }
fn update(&mut self, msg: Self::Message) -> ShouldRender { fn update(&mut self, _msg: Self::Message) -> ShouldRender {
match msg {
Msg::ChangeNavbarItem(index) => {
for (i, _) in self.navbar_items.clone().into_iter().enumerate() {
self.navbar_items[i] = false;
}
self.navbar_items[index] = true;
}
}
true true
} }
@ -60,36 +37,6 @@ impl Component for App {
fn view(&self) -> Html { fn view(&self) -> Html {
html! { html! {
<div> <div>
<Navbar
class_name="navbar-router"
navbar_palette=Palette::Info
navbar_style=Style::Regular
fixed=Fixed::Top
branch=html!{<img src="assets/snek.gif"/>}
>
<NavbarContainer>
<NavbarItem
class_name="navbar-route"
active = self.navbar_items[0]
onclick_signal = self.link.callback(|_| Msg::ChangeNavbarItem(0))
>
<RouterAnchor<AppRouter>route=AppRouter::RootPath>{"Home"}</RouterAnchor<AppRouter>></NavbarItem>
<NavbarItem
class_name="navbar-route">
<a href="https://github.com/trivernis" target="_blank">{"GitHub"}</a>
</NavbarItem>
<NavbarItem
class_name="navbar-route">
<a href="https://discord.gg/ZxzM2bTeXU" target="_blank">{"Discord"}</a>
</NavbarItem>
<NavbarItem
class_name="navbar-route"
active = self.navbar_items[1]
onclick_signal = self.link.callback(|_| Msg::ChangeNavbarItem(1))
>
<RouterAnchor<AppRouter>route=AppRouter::AboutPath>{"About this Website"}</RouterAnchor<AppRouter>></NavbarItem>
</NavbarContainer>
</Navbar>
<Router<AppRouter, ()> <Router<AppRouter, ()>
render = Router::render(|switch: AppRouter | { render = Router::render(|switch: AppRouter | {
match switch { match switch {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

@ -25,6 +25,14 @@ impl Component for Home {
fn view(&self) -> Html { fn view(&self) -> Html {
html! { html! {
<Container direction=Direction::Row wrap=Wrap::Wrap class_name="content"> <Container direction=Direction::Row wrap=Wrap::Wrap class_name="content">
<Item layouts=vec!(ItemLayout::ItXs(12), ItemLayout::ItM(12)) class_name="home-icons">
<a class="icon" href="https://github.com/trivernis" target="_blank">
<img src="assets/github-logo.png"/>
</a>
<a class="icon" href="https://discord.gg/ZxzM2bTeXU" target="_blank">
<img src="assets/discord-logo.png"/>
</a>
</Item>
<Item layouts=vec!(ItemLayout::ItXs(12), ItemLayout::ItM(8)) class_name="home-greeting"> <Item layouts=vec!(ItemLayout::ItXs(12), ItemLayout::ItM(8)) class_name="home-greeting">
<h1>{"Welcome to my website"}</h1> <h1>{"Welcome to my website"}</h1>
</Item> </Item>

@ -27,7 +27,6 @@ body {
animation: 1s ease-out 0s 1 appear; animation: 1s ease-out 0s 1 appear;
} }
.content { .content {
margin: 10% 15% 5em; margin: 5% 15% 5em;
} }

@ -27,4 +27,19 @@
margin: auto; margin: auto;
display: flex; display: flex;
} }
}
.home-icons {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
.icon {
padding: 15px;
img {
height: 50px;
width: auto;
}
}
} }
Loading…
Cancel
Save