From 9a27f3c917435a0f41aed6046e3badd2ddedc7ce Mon Sep 17 00:00:00 2001 From: Mitchell M Date: Sun, 5 May 2024 17:10:31 -0500 Subject: [PATCH] minor tweaks --- Cargo.toml | 3 ++- src/form.rs | 6 ++++-- src/styles/tw_grid.rs | 23 ++++++++++++++--------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 93e0945..7689197 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -leptos = "0.6.9" +leptos = "0.6" +leptos_router = "0.6" diff --git a/src/form.rs b/src/form.rs index 5516411..64308e1 100644 --- a/src/form.rs +++ b/src/form.rs @@ -299,14 +299,16 @@ pub trait FormData: Default + Clone + 'static { /// Defines how the form should be layed out and how the data should be parsed and validated. /// + /// To construct a [`From`] object, use one of the [`get_form`()] methods. + /// /// Uses the given form builder to specify what fields should be present /// in the form, what properties those fields should have, and how that /// data should be parsed and checked. fn build_form(fb: FormBuilder) -> FormBuilder; - /// Gets the [`Form`] for this FormData type. + /// Constructs a [`Form`] for this FormData type. /// - /// The [`Form`] provides the way to render the form + /// The [`Form`] provides the way to render the form. fn get_form(style: Self::Style) -> Form { let builder = FormBuilder::new_full_builder(style); let builder = Self::build_form(builder); diff --git a/src/styles/tw_grid.rs b/src/styles/tw_grid.rs index eee1cea..afadf76 100644 --- a/src/styles/tw_grid.rs +++ b/src/styles/tw_grid.rs @@ -4,6 +4,7 @@ use crate::controls::{ text_input::TextInputData, ControlData, ControlRenderData, }; use leptos::*; +use leptos_router::Form; pub enum TailwindGridStylingAttributes { Width(u32), @@ -18,9 +19,9 @@ impl FormStyle for TailwindGridFormStyle { // TODO: something about an on-submit thing fn form_frame(&self, children: View) -> View { view! { -
+ {children} -
+ } .into_view() } @@ -43,13 +44,17 @@ impl FormStyle for TailwindGridFormStyle { ) -> View { view! {
- {move || format!("{:?}", validation_state.get())} - +
+ + + {move || format!("{}", validation_state.get().err().unwrap_or_default())} + +