summaryrefslogtreecommitdiff
path: root/src/view/mod.rs
blob: b47612a9b2e165a0b5d51e1c73e63d4d5b9f563f (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
use yew::prelude::*;
use crate::viewmodel::*;

pub mod main;
pub mod name;
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>
                        }
                    ) 
                }
            </>
        }
    }
}