boilerplate

This commit is contained in:
2026-03-10 14:29:43 +01:00
commit 2d19e3b5d7
23 changed files with 6997 additions and 0 deletions

37
src/components/echo.rs Normal file
View File

@ -0,0 +1,37 @@
use dioxus::prelude::*;
const ECHO_CSS: Asset = asset!("/assets/styling/echo.css");
#[component]
pub fn Echo() -> Element {
let mut response = use_signal(|| String::new());
rsx! {
document::Link { rel: "stylesheet", href: ECHO_CSS }
div {
id: "echo",
h4 { "ServerFn Echo" }
input {
placeholder: "Type here to echo...",
oninput: move |event| async move {
let data = echo_server(event.value()).await.unwrap();
response.set(data);
},
}
if !response().is_empty() {
p {
"Server echoed: "
i { "{response}" }
}
}
}
}
}
#[post("/api/echo")]
async fn echo_server(input: String) -> Result<String> {
Ok(input)
}

21
src/components/hero.rs Normal file
View File

@ -0,0 +1,21 @@
use dioxus::prelude::*;
const HEADER_SVG: Asset = asset!("/assets/header.svg");
#[component]
pub fn Hero() -> Element {
rsx! {
div {
id: "hero",
img { src: HEADER_SVG, id: "header" }
div { id: "links",
a { href: "https://dioxuslabs.com/learn/0.7/", "📚 Learn Dioxus" }
a { href: "https://dioxuslabs.com/awesome", "🚀 Awesome Dioxus" }
a { href: "https://github.com/dioxus-community/", "📡📡 📡 📡 📡" }
a { href: "https://github.com/DioxusLabs/sdk", "⚙️ Dioxus Development Kit" }
a { href: "https://marketplace.visualstudio.com/items?itemName=DioxusLabs.dioxus", "some useless shit" }
a { href: "https://discord.gg/XgGxMSkvUM", "who tf uses discord ??" }
}
}
}
}

6
src/components/mod.rs Normal file
View File

@ -0,0 +1,6 @@
mod hero;
pub use hero::Hero;
mod echo;
pub use echo::Echo;