use crate::components::shared::{disabled_cls, CONTROL_MOTION, FOCUS_RING};
use leptos::prelude::*;
#[component]
pub fn Input(
#[prop(default = "text".to_string())] input_type: String,
#[prop(default = String::new())] placeholder: String,
#[prop(default = false)] disabled: bool,
value: RwSignal<String>,
#[prop(default = String::new())] class: String,
) -> impl IntoView {
let disabled_class = disabled_cls(disabled);
let combined = format!(
"flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground shadow-elev-sm hover:border-ring/60 {} {} {} {}",
CONTROL_MOTION, FOCUS_RING, disabled_class, class
);
view! {
<input
type=input_type
placeholder=placeholder
disabled=disabled
class=combined
prop:value=move || value.get()
on:input=move |e| value.set(event_target_value(&e))
/>
}
}