use crate::view::dates::*; use super::*; /// Type that represents the vcard `anniversary` and `birthday` properties. #[derive(Clone, Debug)] pub struct Dates { pub anniversary: String, pub birthday: String, } impl VCardPropertyInputObject for Dates { fn new() -> Self { Self { anniversary: String::new(), birthday: String::new(), } } fn get_input_fields(&self, link: &yew::html::Scope) -> std::vec::Vec { let typ = String::from("date"); vec![ VCardPropertyInputField::Text{ label: "Anniversary".to_string(), id: Some("anniversary".to_string()), placeholder: None, oninput: link.callback(|e: InputData| Msg::UpdateAnniversary(e.value)), value: self.anniversary.clone(), typ: typ.clone(), }, VCardPropertyInputField::Text{ label: "Birthday".to_string(), id: Some("birthday".to_string()), placeholder: None, oninput: link.callback(|e: InputData| Msg::UpdateBirthday(e.value)), value: self.birthday.clone(), typ, }, ] } fn is_empty(&self) -> bool { self.anniversary.is_empty() && self.birthday.is_empty() } }