Skip to content

Instantly share code, notes, and snippets.

@Enigo
Last active April 19, 2023 04:11
Show Gist options
  • Save Enigo/eccf6cae43b7ae55ee9b036bb48d2090 to your computer and use it in GitHub Desktop.
Save Enigo/eccf6cae43b7ae55ee9b036bb48d2090 to your computer and use it in GitHub Desktop.
use crate::view::home::Home;
use yew::prelude::*;
use yew_router::prelude::*;
#[derive(Clone, Routable, PartialEq)]
pub enum Route {
#[at("/:token_address")]
Collection { token_address: String },
#[at("/")]
Home,
#[not_found]
#[at("/404")]
NotFound,
}
pub fn switch(route: Route) -> Html {
match route {
Route::Home => html! { <Home />},
Route::Collection { token_address } => html! { <p class="text-white">{ token_address }</p> },
Route::NotFound => html! { <p class="text-white">{ "Not found" }</p> },
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment