use leptos::View; use crate::{ControlBuilder, ControlData, FormBuilder, FormData, FormStyleProvider}; pub struct TextAreaData { pub(crate) name: String, pub(crate) placeholder: Option, } impl TextAreaData { fn new(name: String) -> Self { TextAreaData { name, placeholder: None, } } } impl ControlData for TextAreaData { fn build_control(self, fs: &FS, attributes: Vec) -> View { fs.text_area(self, attributes) } } impl FormBuilder { pub fn text_area(self, name: impl ToString) -> ControlBuilder { ControlBuilder { fb: self, parse_fn: None, style_attributes: Vec::new(), data: TextAreaData::new(name.to_string()), } } } impl ControlBuilder { pub fn placeholder(mut self, placeholder: impl ToString) -> Self { self.data.placeholder = Some(placeholder.to_string()); self } }