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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use crate::Tooltip;
use yew::prelude::*;

#[derive(Clone, Debug, PartialEq, Properties)]
pub struct LoginMainFooterLinkProps {
    #[prop_or_default]
    pub href: Option<String>,
    #[prop_or_default]
    pub onclick: Option<Callback<MouseEvent>>,
    #[prop_or_default]
    pub label: String,
    #[prop_or_default]
    pub target: String,
    #[prop_or_default]
    pub children: Children,
}

#[function_component(LoginMainFooterLink)]
pub fn login_main_footer_link(props: &LoginMainFooterLinkProps) -> Html {
    let link = html! (
        <a
            class="pf-c-login__main-footer-links-item-link"
            href={props.href.clone()}
            onclick={props.onclick.clone()}
            target={props.target.clone()}
            aria_label={props.label.clone()}
            >
            { for props.children.iter() }
        </a>
    );

    if props.label.is_empty() {
        link
    } else {
        html! (
            <Tooltip text={props.label.clone()}>
                {link}
            </Tooltip>
        )
    }
}

#[derive(Clone, Debug, PartialEq, Properties)]
pub struct LoginMainFooterProps {
    #[prop_or_default]
    pub children: Children,
    #[prop_or_default]
    pub band: Children,
    #[prop_or_default]
    pub links: ChildrenWithProps<LoginMainFooterLink>,
}

#[function_component(LoginMainFooter)]
pub fn login_main_footer(props: &LoginMainFooterProps) -> Html {
    html! (
        <footer class="pf-c-login__main-footer">
            { for props.children.iter() }

            if props.links.len() > 0 {
                <ul class="pf-c-login__main-footer-links">
                { for props.links.iter().map(|item|{
                    html!{ <li class="pf-c-login__main-footer-links-item">{item}</li> }
                }) }
                </ul>
            }

            if props.band.len() > 0 {
                <div class="pf-c-login__main-footer-band">
                { for props.band.iter().map(|item|{
                    html!{ <p class="pf-c-login__main-footer-band-item">{item}</p> }
                }) }
                </div>
            }

        </footer>
    )
}