generated from mitchell/rust_template
minor tweaks
This commit is contained in:
parent
bc1216ef26
commit
9a27f3c917
@ -4,5 +4,6 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
leptos = "0.6.9"
|
||||
leptos = "0.6"
|
||||
leptos_router = "0.6"
|
||||
|
||||
|
||||
@ -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<Self, Self::Style>) -> FormBuilder<Self, Self::Style>;
|
||||
|
||||
/// 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<Self> {
|
||||
let builder = FormBuilder::new_full_builder(style);
|
||||
let builder = Self::build_form(builder);
|
||||
|
||||
@ -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! {
|
||||
<form>
|
||||
<Form action="">
|
||||
{children}
|
||||
</form>
|
||||
</Form>
|
||||
}
|
||||
.into_view()
|
||||
}
|
||||
@ -43,13 +44,17 @@ impl FormStyle for TailwindGridFormStyle {
|
||||
) -> View {
|
||||
view! {
|
||||
<div>
|
||||
{move || format!("{:?}", validation_state.get())}
|
||||
<label
|
||||
for={&control.data.name}
|
||||
class="block uppercase tracking-wide text-left text-gray-700 text-md font-bold ml-2 mb-1"
|
||||
>
|
||||
{control.data.label.as_ref()}
|
||||
</label>
|
||||
<div>
|
||||
<label
|
||||
for={&control.data.name}
|
||||
class="block uppercase tracking-wide text-left text-gray-700 text-md font-bold ml-2 mb-1 inline"
|
||||
>
|
||||
{control.data.label.as_ref()}
|
||||
</label>
|
||||
<span class="inline pl-2 text-red-600">
|
||||
{move || format!("{}", validation_state.get().err().unwrap_or_default())}
|
||||
</span>
|
||||
</div>
|
||||
<input
|
||||
// TODO:
|
||||
type=control.data.input_type
|
||||
|
||||
Reference in New Issue
Block a user