rust-stream-layouts/src/lib.rs

47 lines
1.1 KiB
Rust
Raw Normal View History

2023-06-15 17:22:20 -05:00
//! # Werefox Stream Layouts
//!
//! Rendering functions for stream layouts using [Dioxus](https://dioxuslabs.com/).
#![allow(non_snake_case)]
// mod components;
// pub mod utils;
/// A module that handles the functions needed
/// to render the site.
pub mod layouts_app {
// import the prelude to get access to the `rsx!` macro and the `Scope` and `Element` types
pub use dioxus::prelude::*;
// use dioxus_helmet::Helmet;
use dioxus_router::{Redirect, Route, Router};
// use dioxus_use_storage::use_local_storage;
pub fn DioxusApp(cx: Scope) -> Element {
cx.render(rsx! {
Router {
Route { to: "/", HomePage {} }
Route { to: "", PageNotFound {} }
}
})
}
fn PageNotFound(cx: Scope) -> Element {
cx.render(rsx! {
p { "That page doesn't exist, sorry!" }
Redirect { to: "/" }
})
}
/// Renders the app and returns the rendered Element.
pub fn HomePage(cx: Scope) -> Element {
cx.render(rsx!{
div { class: "",
"Hello, world!"
}
})
}
}