use super::FormStyle;
use crate::controls::{
heading::HeadingData, select::SelectData, submit::SubmitData, text_area::TextAreaData,
text_input::TextInputData, ControlData, ControlRenderData,
};
use leptos::*;
use leptos_router::Form;
pub enum GridFormStylingAttributes {
Width(u32),
}
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct GridFormStyle;
impl FormStyle for GridFormStyle {
type StylingAttributes = GridFormStylingAttributes;
// TODO: something about an on-submit thing
fn form_frame(&self, children: View) -> View {
view! {
}
.into_view()
}
fn heading(&self, control: ControlRenderData) -> View {
view! {
}
.into_view()
}
fn text_input(
&self,
control: ControlRenderData,
value_getter: Signal<::ReturnType>,
value_setter: Box::ReturnType)>,
validation_state: Signal>,
) -> View {
view! {
}
.into_view()
}
fn select(
&self,
control: ControlRenderData,
value_getter: Signal<::ReturnType>,
value_setter: Box::ReturnType)>,
validation_state: Signal>,
) -> View {
let options_view = control
.data
.options
.into_iter()
.map(|value| {
// let value = value;
let cloned_value = value.clone();
view! {
}
})
.collect_view();
view! {
{move || format!("{:?}", validation_state.get())}
}
.into_view()
}
fn submit(&self, control: ControlRenderData) -> View {
view! {
}
.into_view()
}
fn text_area(
&self,
control: ControlRenderData,
value_getter: Signal<::ReturnType>,
value_setter: Box::ReturnType)>,
validation_state: Signal>,
) -> View {
view! {
{move || format!("{:?}", validation_state.get())}
}
.into_view()
}
fn custom_component(&self, view: View) -> View {
view
}
}