From a507ab07be7feff1a602310bcdd304199b06c401 Mon Sep 17 00:00:00 2001 From: Connor Johnstone Date: Thu, 28 Aug 2025 14:36:34 -0400 Subject: [PATCH] Initial commit: Basic Yew frontend template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Set up Cargo.toml with Yew dependencies - Created main.rs entry point - Added basic App component with counter functionality - Included HTML template with styling - Added Trunk.toml for build configuration - Added .gitignore to exclude build artifacts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .gitignore | 14 ++++++++++++++ Cargo.toml | 9 +++++++++ Trunk.toml | 11 +++++++++++ index.html | 40 ++++++++++++++++++++++++++++++++++++++++ src/app.rs | 24 ++++++++++++++++++++++++ src/main.rs | 8 ++++++++ 6 files changed, 106 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 Trunk.toml create mode 100644 index.html create mode 100644 src/app.rs create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..524406b --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Rust +target/ +Cargo.lock + +# Build outputs +dist/ + +# OS +.DS_Store +.vscode/ +.idea/ + +# Logs +*.log \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..91d47a6 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "yew-app" +version = "0.1.0" +edition = "2021" + +[dependencies] +yew = { version = "0.21", features = ["csr"] } +web-sys = "0.3" +wasm-bindgen = "0.2" \ No newline at end of file diff --git a/Trunk.toml b/Trunk.toml new file mode 100644 index 0000000..ed9e74f --- /dev/null +++ b/Trunk.toml @@ -0,0 +1,11 @@ +[build] +target = "index.html" +dist = "dist" + +[watch] +watch = ["src", "Cargo.toml"] + +[serve] +address = "127.0.0.1" +port = 8080 +open = false \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..852782b --- /dev/null +++ b/index.html @@ -0,0 +1,40 @@ + + + + + Yew App + + + + + \ No newline at end of file diff --git a/src/app.rs b/src/app.rs new file mode 100644 index 0000000..ca0bff9 --- /dev/null +++ b/src/app.rs @@ -0,0 +1,24 @@ +use yew::prelude::*; + +#[function_component] +pub fn App() -> Html { + let counter = use_state(|| 0); + let onclick = { + let counter = counter.clone(); + move |_| { + let value = *counter + 1; + counter.set(value); + } + }; + + html! { +
+

{ "Hello Yew!" }

+

{ "This is a basic Yew application template." }

+
+ +

{ format!("Counter: {}", *counter) }

+
+
+ } +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..056c44b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,8 @@ +use yew::prelude::*; + +mod app; +use app::App; + +fn main() { + yew::Renderer::::new().render(); +} \ No newline at end of file