From b1ba906491a1ed396d47b0751f080fef991ea344 Mon Sep 17 00:00:00 2001 From: jelemux Date: Wed, 25 Nov 2020 10:31:04 +0100 Subject: Struktur umbauen --- src/view/input_objects/mod.rs | 106 ------------------------------------------ 1 file changed, 106 deletions(-) delete mode 100644 src/view/input_objects/mod.rs (limited to 'src/view/input_objects/mod.rs') diff --git a/src/view/input_objects/mod.rs b/src/view/input_objects/mod.rs deleted file mode 100644 index 7c0fdff..0000000 --- a/src/view/input_objects/mod.rs +++ /dev/null @@ -1,106 +0,0 @@ -use vcard::properties; -use yew::prelude::*; -use super::VCardPropertyInputComponent; - -pub mod address; -pub mod birthday; -pub mod name; -pub mod photo; -pub mod telephone; -pub mod utility; - -pub trait VCardPropertyInputObject> - where Self: Sized -{ - fn new() -> Self; - fn get_input_fields(&self, link: &ComponentLink) -> Vec; - fn render(&self, link: &ComponentLink) -> Html { - html!{ -
- { - for self.get_input_fields(link).iter().map(|field| - field.render() - ) - } -
- } - } - fn to_vcard_property(&self) -> Result; -} - -#[derive(Debug)] -pub struct VCardPropertyInputError { - msg: String, -} - -pub enum VCardPropertyInputField { - Text { - label: String, - id: Option, - placeholder: Option, - oninput: Callback, - value: String, - }, - CheckBox { - label: String, - id: Option, - onclick: Callback, - value: bool, - }, -} - -impl VCardPropertyInputField { - pub fn render(&self) -> Html { - match self { - Self::Text { - label, - id, - placeholder, - oninput, - value: _, - } => Self::text_field_input(label, id, placeholder, oninput), - Self::CheckBox { - label, - id, - onclick, - value, - } => Self::checkbox_field_input(label, id, value, onclick), - } - } - fn text_field_input(label: &str, id: &Option, placeholder: &Option, oninput: &Callback) -> Html { - html!{ -
- -
- -
-
- } - } - fn checkbox_field_input(label: &str, id: &Option, checked: &bool, onclick: &Callback) -> Html { - html!{ -
- -
- } - } -} \ No newline at end of file -- cgit v1.2.3