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
use yew::prelude::*;

#[derive(Clone, PartialEq, Properties)]
pub struct Props {
    pub children: Children,
    #[prop_or_default]
    pub gutter: bool,
}

#[function_component(Gallery)]
pub fn gallery(props: &Props) -> Html {
    let mut classes = Classes::from("pf-l-gallery");

    if props.gutter {
        classes.push("pf-m-gutter");
    }

    html! {
        <div class={classes}>
        { for props.children.iter().map(|child|{
            html!{
                <div class="pf-l-gallery__item">
                    { child }
                </div>
            }
        }) }
        </div>
    }
}