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-v6-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! (<Tooltip text={props.label.clone()}>{ link }</Tooltip>)
37 }
38}
39
40#[derive(Clone, Debug, PartialEq, Properties)]
42pub struct LoginMainFooterProperties {
43 #[prop_or_default]
44 pub children: Html,
45 #[prop_or_default]
46 pub band: Children,
47 #[prop_or_default]
48 pub links: ChildrenWithProps<LoginMainFooterLink>,
49}
50
51#[function_component(LoginMainFooter)]
52pub fn login_main_footer(props: &LoginMainFooterProperties) -> Html {
53 html! (
54 <footer class="pf-v6-c-login__main-footer">
55 { props.children.clone() }
56 if !props.links.is_empty() {
57 <ul class="pf-v6-c-login__main-footer-links">
58 { for props.links.iter().map(|item|{
59 html!{ <li class="pf-v6-c-login__main-footer-links-item">{item}</li> }
60 }) }
61 </ul>
62 }
63 if !props.band.is_empty() {
64 <div class="pf-v6-c-login__main-footer-band">
65 { for props.band.iter().map(|item|{
66 html!{ <p class="pf-v6-c-login__main-footer-band-item">{item.clone()}</p> }
67 }) }
68 </div>
69 }
70 </footer>
71 )
72}