feat: added content to home

This commit is contained in:
antifallobst 2023-09-28 16:54:00 +02:00
parent b24115ce20
commit 4d8449f63a
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
8 changed files with 81 additions and 7 deletions

8
src/content/error.rs Normal file
View File

@ -0,0 +1,8 @@
use yew::prelude::*;
#[function_component]
pub fn NotFound() -> Html {
html! {
<h1>{"404 - Not Found"}</h1>
}
}

47
src/content/home.rs Normal file
View File

@ -0,0 +1,47 @@
use yew::prelude::*;
#[function_component]
pub fn Home() -> Html {
html! {
<div class="content">
<ul id="content-boxes">
<li class="content-box">
<p class="content-box-heading">{"Community"}</p>
<div class="content-box-data">
<p>{
"Nerdcult is a platform for (and by) open source
software developers, that aims to make collaboration
as comfortable as possible. We also want to make
it as easy as possible for users to find contributors
for their projects.
Join now by creating an account."
}</p>
</div>
</li>
<li class="content-box">
<p class="content-box-heading">{"Tools"}</p>
<div class="content-box-data">
<p>{
"We provide tools for software development, communication and project management.
This includes a git server, a matrix homeserver, pads and much more :)"
}</p>
</div>
</li>
<li class="content-box">
<p class="content-box-heading">{"Privacy"}</p>
<div class="content-box-data">
<p>{
"We save as less personal data as possible and our logs are anonymized.
Your private data is encrypted with a key that derives from your password.
By that we couldn't sell data and give attackers nothing they could steal."
}</p>
</div>
</li>
</ul>
</div>
}
}

2
src/content/mod.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod home;
pub mod error;

View File

@ -1,5 +1,10 @@
mod content;
mod state;
mod topbar; mod topbar;
use content::{error, home::Home};
use state::State;
use std::rc::Rc;
use topbar::TopBar; use topbar::TopBar;
use yew::prelude::*; use yew::prelude::*;
use yew_router::prelude::*; use yew_router::prelude::*;
@ -21,25 +26,27 @@ enum Route {
fn switch(routes: Route) -> Html { fn switch(routes: Route) -> Html {
match routes { match routes {
Route::Home => html! { <h1>{ "Home" }</h1> }, Route::Home => html! { <Home/> },
Route::Services => html! {<h1>{ "Services" }</h1>}, Route::Services => html! {<h1>{ "Services" }</h1>},
Route::Community => html! {<h1>{ "Community" }</h1>}, Route::Community => html! {<h1>{ "Community" }</h1>},
Route::About => html! {<h1>{ "About" }</h1>}, Route::About => html! {<h1>{ "About" }</h1>},
Route::NotFound => html! { <h1>{ "404" }</h1> }, Route::NotFound => html! { <error::NotFound/> },
} }
} }
#[function_component] #[function_component]
fn App() -> Html { fn App() -> Html {
let state = use_memo(|_| State::default(), ());
html! { html! {
<div> <ContextProvider<Rc<State>> context={state}>
<TopBar/> <TopBar/>
<main> <main>
<BrowserRouter> <BrowserRouter>
<Switch<Route> render={switch} /> <Switch<Route> render={switch} />
</BrowserRouter> </BrowserRouter>
</main> </main>
</div> </ContextProvider<Rc<State>>>
} }
} }

10
src/state.rs Normal file
View File

@ -0,0 +1,10 @@
#[derive(Clone, PartialEq)]
pub struct State {
auth_token: Option<String>,
}
impl Default for State {
fn default() -> Self {
Self { auth_token: None }
}
}

View File

@ -15,9 +15,9 @@ main {
} }
.content { .content {
margin: 12px;
padding: 12px; padding: 12px;
height: calc(100% - 48px); height: calc(100% - 86px);
width: calc(100% - 24px);
} }
#content-boxes { #content-boxes {

View File

@ -39,7 +39,7 @@
#tabs-account { #tabs-account {
float: right; float: right;
margin-right: 32px; margin-right: 24px;
padding: 0; padding: 0;
list-style: none; list-style: none;
} }