athome/src/main.rs

82 lines
1.7 KiB
Rust
Raw Normal View History

#![allow(non_snake_case)]
use dioxus::prelude::*;
use tracing::Level;
pub mod components;
mod cv;
mod home;
mod impressum;
mod layout;
mod publications;
use crate::cv::CV;
use crate::home::Home;
use crate::impressum::Impressum;
use crate::layout::Layout;
use crate::publications::ProjectsPublications;
#[derive(Clone, Routable, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum Route {
#[layout(Layout)]
#[route("/")]
Home {},
#[route("/impressum")]
Impressum {},
#[route("/publications")]
ProjectsPublications {},
#[route("/resume")]
CV {},
#[end_layout]
#[route("/:..route")]
PageNotFound { route: Vec<String> },
}
fn main() {
dioxus_logger::init(Level::DEBUG).expect("failed to init logger");
launch(App);
}
fn App() -> Element {
rsx! {
meta {
name: "robots",
content: "noindex",
},
div {
class: "bg-white dark:bg-gray-900 min-h-screen",
Router::<Route> {},
}
}
}
#[component]
fn PageNotFound(route: Vec<String>) -> Element {
rsx! {
div {
class: "h-screen flex items-center justify-center",
img {
class: "size-auto",
src: "https://raw.githubusercontent.com/SAWARATSUKI/ServiceLogos/main/404Notfound/NotFound.png"
}
}
}
}
#[derive(PartialEq, Props, Clone)]
pub struct BodyProp {
children: Element,
}
pub fn Body(prop: BodyProp) -> Element {
rsx! {
div {
class: "flex justify-center my-4",
div {
class: "max-w-screen-md min-w-full",
{prop.children}
}
}
}
}