feat: implement into for all applicable props
This commit is contained in:
1 parent
df8b248ae4
commit
71ff8e6dc9
8 files changed
+113
-37
No files matched your search
@@ -3,12 +3,12 @@ use leptos::prelude::*;
|
||||
|
||||
#[component]
|
||||
pub fn OutlinedTextField<T>(
|
||||
#[prop(default = String::from(""))] placeholder: String,
|
||||
#[prop(default = T::default(), into)] placeholder: T,
|
||||
#[prop(default = RwSignal::new(T::default()))] value: RwSignal<T>,
|
||||
#[prop(default = RwSignal::new(false))] disabled: RwSignal<bool>,
|
||||
#[prop(default = String::from(""))] name: String,
|
||||
#[prop(default = String::from(""))] label: String,
|
||||
#[prop(default = String::from(""))] input_type: String,
|
||||
#[prop(default = String::from(""), into)] name: String,
|
||||
#[prop(default = String::from(""), into)] label: String,
|
||||
#[prop(default = String::from(""), into)] input_type: String,
|
||||
) -> impl IntoView
|
||||
where
|
||||
T: Default + 'static + FromStr + ToString + PartialEq + Send + Sync + Clone
|
||||
@@ -22,16 +22,17 @@ where
|
||||
};
|
||||
|
||||
view! (
|
||||
<div>
|
||||
<label>
|
||||
{ label }
|
||||
<div class="flex flex-1">
|
||||
<label class="flex flex-col flex-1">
|
||||
<span class="block ml-1.5 mb-0">{label}</span>
|
||||
<input
|
||||
class="border-2 m-1.5 p-1.5 rounded-md bg-transparent mt-6 relative transition-all duration-150
|
||||
class="border-2 m-1.5 p-1.5 mt-0 rounded-md bg-transparent relative flex-1
|
||||
transition-all duration-150
|
||||
border-red-700 bg-transparent
|
||||
disabled:border-gray-600 disabled:pointer-events-none disabled:bg-gray-600/33"
|
||||
r#type={input_type}
|
||||
disabled={disabled}
|
||||
placeholder={placeholder}
|
||||
placeholder={placeholder.to_string()}
|
||||
prop:name=name
|
||||
prop:value={move || value.get().to_string()} // Sets the initial value.
|
||||
on:input=on_input // Sets the value on each input.
|
||||
|
||||
Reference in new issue
Block a user