[init] Created dioxus project

This commit is contained in:
2025-08-21 14:18:26 +02:00
commit ffbf5e6aa3
43 changed files with 6910 additions and 0 deletions

54
mobile/src/main.rs Normal file
View File

@@ -0,0 +1,54 @@
use dioxus::prelude::*;
use ui::Navbar;
use views::{Blog, Home};
mod views;
#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
enum Route {
#[layout(MobileNavbar)]
#[route("/")]
Home {},
#[route("/blog/:id")]
Blog { id: i32 },
}
const MAIN_CSS: Asset = asset!("/assets/main.css");
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
// Build cool things ✌️
rsx! {
// Global app resources
document::Link { rel: "stylesheet", href: MAIN_CSS }
Router::<Route> {}
}
}
/// A mobile-specific Router around the shared `Navbar` component
/// which allows us to use the mobile-specific `Route` enum.
#[component]
fn MobileNavbar() -> Element {
rsx! {
Navbar {
Link {
to: Route::Home {},
"Home"
}
Link {
to: Route::Blog { id: 1 },
"Blog"
}
}
Outlet::<Route> {}
}
}