patternfly_yew/components/login_page/
footer.rs1use crate::prelude::Tooltip;
2use yew::prelude::*;
3
4#[derive(Clone, Debug, PartialEq, Properties)]
6pub struct LoginMainFooterLinkProperties {
7 #[prop_or_default]
8 pub href: Option<String>,
9 #[prop_or_default]
10 pub onclick: Option<Callback<MouseEvent>>,
11 #[prop_or_default]
12 pub label: String,
13 #[prop_or_default]
14 pub target: Option<AttrValue>,
15 #[prop_or_default]
16 pub children: Html,
17}
18
19#[function_component(LoginMainFooterLink)]
20pub fn login_main_footer_link(props: &LoginMainFooterLinkProperties) -> Html {
21 let link = html! (
22 <a
23 class="pf-v5-c-login__main-footer-links-item-link"
24 href={props.href.clone()}
25 onclick={props.onclick.clone()}
26 target={props.target.clone()}
27 aria_label={props.label.clone()}
28 >
29 { props.children.clone() }
30 </a>
31 );
32
33 if props.label.is_empty() {
34 link
35 } else {
36 html! (
37 <Tooltip text={props.label.clone()}>
38 {link}
39 </Tooltip>
40 )
41 }
42}
43
44#[derive(Clone, Debug, PartialEq, Properties)]
46pub struct LoginMainFooterProperties {
47 #[prop_or_default]
48 pub children: Html,
49 #[prop_or_default]
50 pub band: Children,
51 #[prop_or_default]
52 pub links: ChildrenWithProps<LoginMainFooterLink>,
53}
54
55#[function_component(LoginMainFooter)]
56pub fn login_main_footer(props: &LoginMainFooterProperties) -> Html {
57 html! (
58 <footer class="pf-v5-c-login__main-footer">
59 { props.children.clone() }
60
61 if !props.links.is_empty() {
62 <ul class="pf-v5-c-login__main-footer-links">
63 { for props.links.iter().map(|item|{
64 html!{ <li class="pf-v5-c-login__main-footer-links-item">{item}</li> }
65 }) }
66 </ul>
67 }
68
69 if !props.band.is_empty() {
70 <div class="pf-v5-c-login__main-footer-band">
71 { for props.band.iter().map(|item|{
72 html!{ <p class="pf-v5-c-login__main-footer-band-item">{item.clone()}</p> }
73 }) }
74 </div>
75 }
76
77 </footer>
78 )
79}