diff --git a/src/content/mod.rs b/src/content/mod.rs index caa9ce4..864faf8 100644 --- a/src/content/mod.rs +++ b/src/content/mod.rs @@ -1,3 +1,4 @@ pub mod about; +pub mod error; pub mod home; -pub mod error; \ No newline at end of file +pub mod profile; diff --git a/src/content/profile/mod.rs b/src/content/profile/mod.rs new file mode 100644 index 0000000..b62aef0 --- /dev/null +++ b/src/content/profile/mod.rs @@ -0,0 +1,13 @@ +use yew::prelude::*; + +#[derive(PartialEq, Properties)] +pub struct Props { + pub username: AttrValue, +} + +#[function_component] +pub fn Profile(props: &Props) -> Html { + html! { +

{"User profile: "}{props.username.clone()}

+ } +} diff --git a/src/main.rs b/src/main.rs index 88f72b0..89ba8a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ mod content; mod topbar; use backend::Session; -use content::{about::About, error, home::Home}; +use content::{about::About, error, home::Home, profile::Profile}; use gloo::dialogs::alert; use gloo_storage::{SessionStorage, Storage}; use std::ops::Deref; @@ -21,6 +21,8 @@ enum Route { Community, #[at("/about")] About, + #[at("/profile/:username")] + Profile { username: String }, #[not_found] #[at("/404")] NotFound, @@ -32,6 +34,7 @@ fn switch(routes: Route) -> Html { Route::Services => html! {

{ "Services" }

}, Route::Community => html! {

{ "Community" }

}, Route::About => html! {}, + Route::Profile { username } => html! { }, Route::NotFound => html! { }, } }