summaryrefslogtreecommitdiff
path: root/src/viewmodel/mod.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-05 18:05:16 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-05 18:05:16 +0100
commitfd5b054fe655c81533c8a1138ba55a82a7b9d085 (patch)
tree2d90466a05356490ed3d15fa19e8dc0fe763499e /src/viewmodel/mod.rs
parent87007b8785be959ca7687e2bec7401514e92581d (diff)
downloadwasm-card-fd5b054fe655c81533c8a1138ba55a82a7b9d085.tar.gz
wasm-card-fd5b054fe655c81533c8a1138ba55a82a7b9d085.tar.bz2
add date properties
Diffstat (limited to 'src/viewmodel/mod.rs')
-rw-r--r--src/viewmodel/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/viewmodel/mod.rs b/src/viewmodel/mod.rs
index d5d0de3..edd1a8e 100644
--- a/src/viewmodel/mod.rs
+++ b/src/viewmodel/mod.rs
@@ -2,10 +2,11 @@ use yew::prelude::*;
use crate::view::VCardPropertyInputComponent;
pub mod vcard;
+pub mod utility;
pub mod address;
pub mod name;
pub mod telephone;
-pub mod utility;
+pub mod dates;
/// Trait for types that represent the data of a vcard property used inside of a `VCardPropertyInputComponent`.
@@ -48,6 +49,7 @@ pub enum VCardPropertyInputField {
placeholder: Option<String>,
oninput: Callback<InputData>,
value: String,
+ typ: String
},
CheckBox {
label: String,
@@ -67,7 +69,8 @@ impl VCardPropertyInputField {
placeholder,
oninput,
value: _,
- } => Self::text_field_input(label, id, placeholder, oninput),
+ typ,
+ } => Self::text_field_input(label, id, placeholder, oninput, typ),
Self::CheckBox {
label,
id,
@@ -77,7 +80,7 @@ impl VCardPropertyInputField {
}
}
/// Returns an `Html` representation of a text input field with the given parameters.
- fn text_field_input(label: &str, id: &Option<String>, placeholder: &Option<String>, oninput: &Callback<InputData>) -> Html {
+ fn text_field_input(label: &str, id: &Option<String>, placeholder: &Option<String>, oninput: &Callback<InputData>, typ: &str) -> Html {
html!{
<div class="field column
is-one-fifth-widescreen
@@ -87,7 +90,7 @@ impl VCardPropertyInputField {
<label class="label">{ label }</label>
<div class="control">
<input id=id.as_ref().unwrap_or(&"".to_string())
- type="text"
+ type=typ
placeholder=placeholder.as_ref().unwrap_or(&"".to_string())
oninput=oninput
/>