Initial commit
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
81
src/main.rs
Normal file
81
src/main.rs
Normal file
@@ -0,0 +1,81 @@
|
||||
#![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::Publications;
|
||||
|
||||
#[derive(Clone, Routable, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum Route {
|
||||
#[layout(Layout)]
|
||||
#[route("/")]
|
||||
Home {},
|
||||
#[route("/impressum")]
|
||||
Impressum {},
|
||||
#[route("/publications")]
|
||||
Publications {},
|
||||
#[route("/resume")]
|
||||
CV {},
|
||||
#[end_layout]
|
||||
#[route("/:..route")]
|
||||
PageNotFound { route: Vec<String> },
|
||||
}
|
||||
|
||||
fn main() {
|
||||
dioxus_logger::init(Level::INFO).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}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user