summaryrefslogtreecommitdiff
path: root/src/view/mod.rs
blob: b46accfdb6e918cb83cc20b062ee4111347a7175 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use yew::prelude::*;
use input_objects::*;
pub mod input_objects;

pub mod main;
pub mod name;
pub mod photo;
pub mod birthday;
pub mod address;
pub mod telephone;

pub trait VCardPropertyInputComponent<P, T>: Component 
    where   P: vcard::properties::Property,
            T: VCardPropertyInputObject<P, Self>
{
    fn get_input_object(&self) -> T;
    fn get_title(&self) -> String;
    fn get_errors(&self) -> Vec<String>;
    fn render_errors(&self) -> Html {
        html!{
            <>
                {
                    for self.get_errors().iter().map(|err| 
                        html!{
                            <div class="notification is-danger is-light">
                                { err }
                            </div>
                        }
                    ) 
                }
            </>
        }
    }
}