1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use super::MenuList;
use crate::prelude::MenuChildVariant;
use yew::{html::ChildrenRenderer, prelude::*};

#[derive(Clone, Debug, PartialEq, Properties)]
pub struct MenuGroupProperties {
    #[prop_or_default]
    pub title: Option<String>,
    #[prop_or_default]
    pub children: ChildrenRenderer<MenuChildVariant>,
}

#[function_component(MenuGroup)]
pub fn menu_group(props: &MenuGroupProperties) -> Html {
    html!(
        <section class="pf-v5-c-menu__group">
            if let Some(title) = &props.title {
                <h1 class="pf-v5-c-menu__group-title">{ title }</h1>
            }
            <MenuList>{ props.children.clone() }</MenuList>
        </section>
    )
}