diff --git a/Justfile b/Justfile index 4b7cde2..d23f007 100644 --- a/Justfile +++ b/Justfile @@ -29,7 +29,7 @@ e2e_tests *args='': # Runs formatting tool against Leptos source web-fmt: - leptosfmt ./crates/web/src/*.rs + leptosfmt ./crates/web/src/**/*.rs # Runs Web UI for Development web-dev: diff --git a/crates/web/Cargo.toml b/crates/web/Cargo.toml index 7fd1694..91888f0 100644 --- a/crates/web/Cargo.toml +++ b/crates/web/Cargo.toml @@ -17,7 +17,7 @@ path = "src/bin/main.rs" [dependencies] leptos = { workspace = true, features = ["csr"] } -leptos_meta = { workspace = true } +leptos_meta = { workspace = true, features = ["csr"] } leptos_router = { workspace = true, features = ["csr"] } # Local Dependencies diff --git a/crates/web/src/components/button.rs b/crates/web/src/components/button.rs index 5ade17f..b5d9f5a 100644 --- a/crates/web/src/components/button.rs +++ b/crates/web/src/components/button.rs @@ -63,7 +63,7 @@ pub fn Button( }); view! { - - - - - - + + + } } diff --git a/crates/web/src/views/login.rs b/crates/web/src/views/login.rs index 1f66f68..2a137f6 100644 --- a/crates/web/src/views/login.rs +++ b/crates/web/src/views/login.rs @@ -1,4 +1,7 @@ -use leptos::{component, create_action, create_signal, view, IntoView, Show, SignalGet, SignalSet}; +use leptos::{ + component, create_action, create_rw_signal, create_signal, view, IntoView, Show, SignalGet, + SignalGetUntracked, SignalSet, +}; use townhall_client::Client; @@ -7,12 +10,14 @@ use crate::components::text_field::{TextField, TextFieldType}; #[component] pub fn Login() -> impl IntoView { let (error_getter, error_setter) = create_signal::>(None); + let email_value = create_rw_signal(String::default()); + let password_value = create_rw_signal(String::default()); - let submit = create_action(move |_| async move { + let handle_submit = create_action(move |_| async move { let client = Client::new(); let res = client .auth - .token_create("john@test.com".into(), "12345".into()) + .token_create(email_value.get_untracked(), password_value.get_untracked()) .await; if let Some(ref error) = res.error { @@ -21,24 +26,39 @@ pub fn Login() -> impl IntoView { }); view! { -
-
-
-
-

TownHall

-
- - - - -
- {error_getter.get().unwrap()} +
+
+
+
+

TownHall

+ + + + + +
+ {error_getter.get().unwrap()} +
+
+ +
+ {"Don't have an account? "} + Sign up! +
- - -
{"Don't have an account? "}Sign up!
+
-
} } diff --git a/crates/web/tests/components/text_field.rs b/crates/web/tests/components/text_field.rs index d204675..520898c 100644 --- a/crates/web/tests/components/text_field.rs +++ b/crates/web/tests/components/text_field.rs @@ -1,4 +1,4 @@ -use leptos::{mount_to, view}; +use leptos::{create_rw_signal, mount_to, view}; use wasm_bindgen::JsCast; use wasm_bindgen_test::*; @@ -12,10 +12,11 @@ fn default_text_field_class_names_integrity() { let document = leptos::document(); let test_wrapper = document.create_element("div").unwrap(); let _ = document.body().unwrap().append_child(&test_wrapper); + let value = create_rw_signal(String::new()); mount_to( test_wrapper.clone().unchecked_into(), - || view! { }, + move || view! { }, ); let text_field_el = test_wrapper @@ -49,10 +50,11 @@ fn default_text_field_custom_class_names_integrity() { let document = leptos::document(); let test_wrapper = document.create_element("div").unwrap(); let _ = document.body().unwrap().append_child(&test_wrapper); + let value = create_rw_signal(String::new()); mount_to( test_wrapper.clone().unchecked_into(), - || view! { }, + move || view! { }, ); let text_field_el = test_wrapper