Reformat project

This commit is contained in:
Leonard Steppy 2025-02-21 10:49:50 +01:00
parent f9aae520e9
commit 1d760a2415

View File

@ -1,7 +1,6 @@
use dioxus::prelude::*;
#[derive(Debug, Clone, Routable, PartialEq)]
#[rustfmt::skip]
enum Route {
#[layout(Navbar)]
#[route("/")]
@ -15,7 +14,7 @@ const MAIN_CSS: Asset = asset!("/assets/main.css");
const HEADER_SVG: Asset = asset!("/assets/header.svg");
fn main() {
dioxus::launch(App);
launch(App);
}
#[component]
@ -30,15 +29,16 @@ fn App() -> Element {
#[component]
pub fn Hero() -> Element {
rsx! {
div {
id: "hero",
div { id: "hero",
img { src: HEADER_SVG, id: "header" }
div { id: "links",
a { href: "https://dioxuslabs.com/learn/0.6/", "📚 Learn Dioxus" }
a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" }
a { href: "https://github.com/dioxus-community/", "📡 Community Libraries" }
a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" }
a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "💫 VSCode Extension" }
a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus",
"💫 VSCode Extension"
}
a { href: "https://discord.gg/XgGxMSkvUM", "👋 Community Discord" }
}
}
@ -58,23 +58,18 @@ fn Home() -> Element {
#[component]
pub fn Blog(id: i32) -> Element {
rsx! {
div {
id: "blog",
div { id: "blog",
// Content
h1 { "This is blog #{id}!" }
p { "In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components." }
p {
"In blog #{id}, we show how the Dioxus router works and how URL parameters can be passed as props to our route components."
}
// Navigation links
Link {
to: Route::Blog { id: id - 1 },
"Previous"
}
Link { to: Route::Blog { id: id - 1 }, "Previous" }
span { " <---> " }
Link {
to: Route::Blog { id: id + 1 },
"Next"
}
Link { to: Route::Blog { id: id + 1 }, "Next" }
}
}
}
@ -83,16 +78,9 @@ pub fn Blog(id: i32) -> Element {
#[component]
fn Navbar() -> Element {
rsx! {
div {
id: "navbar",
Link {
to: Route::Home {},
"Home"
}
Link {
to: Route::Blog { id: 1 },
"Blog"
}
div { id: "navbar",
Link { to: Route::Home {}, "Home" }
Link { to: Route::Blog { id: 1 }, "Blog" }
}
Outlet::<Route> {}
@ -105,8 +93,7 @@ fn Echo() -> Element {
let mut response = use_signal(|| String::new());
rsx! {
div {
id: "echo",
div { id: "echo",
h4 { "ServerFn Echo" }
input {
placeholder: "Type here to echo...",