patternfly_yew/components/
brand.rs1use yew::prelude::*;
3
4#[derive(PartialEq, Properties)]
6pub struct BrandProperties {
7 pub src: AttrValue,
8 pub alt: AttrValue,
9
10 #[prop_or_default]
12 pub style: AttrValue,
13
14 #[prop_or_default]
15 pub children: ChildrenWithProps<BrandSource>,
16}
17
18#[derive(Clone, PartialEq, Properties)]
19pub struct BrandSourceProperties {
20 #[prop_or_default]
21 pub media: Option<String>,
23 pub srcset: AttrValue,
25}
26
27#[function_component(BrandSource)]
28pub fn brand_source(props: &BrandSourceProperties) -> Html {
29 html!(
30 <source
31 media={props.media.clone()}
32 srcset={&props.srcset}
33 />
34 )
35}
36
37#[function_component(Brand)]
53pub fn brand(props: &BrandProperties) -> Html {
54 if props.children.is_empty() {
55 html! (
56 <img
57 class="pf-v5-c-brand"
58 style={&props.style}
59 src={&props.src}
60 alt={&props.alt}
61 />
62 )
63 } else {
64 html! (
65 <picture
66 class="pf-v5-c-brand pf-m-picture"
67 style={&props.style}
68 >
69 { for props.children.iter() }
70 <img
71 class="pf-v5-c-brand"
72 src={&props.src}
73 alt={&props.alt}
74 />
75 </picture>
76 )
77 }
78}