patternfly_yew/components/menu/
child.rs

1use crate::prelude::*;
2use std::rc::Rc;
3use yew::prelude::*;
4
5#[derive(Clone, PartialEq)]
6pub enum MenuChild {
7    Action(Rc<<MenuAction as BaseComponent>::Properties>),
8    Link(Rc<<MenuLink as BaseComponent>::Properties>),
9    Divider(Rc<<ListDivider as BaseComponent>::Properties>),
10    Group(Rc<<MenuGroup as BaseComponent>::Properties>),
11    Loading(Rc<<MenuLoading as BaseComponent>::Properties>),
12    Raw(Rc<<Raw as BaseComponent>::Properties>),
13}
14
15impl From<()> for MenuChild {
16    fn from(_: ()) -> Self {
17        MenuChild::Divider(Rc::new(()))
18    }
19}
20
21impl From<MenuActionProperties> for MenuChild {
22    fn from(props: MenuActionProperties) -> Self {
23        MenuChild::Action(Rc::new(props))
24    }
25}
26
27impl From<MenuLinkProperties> for MenuChild {
28    fn from(props: MenuLinkProperties) -> Self {
29        MenuChild::Link(Rc::new(props))
30    }
31}
32
33impl From<MenuGroupProperties> for MenuChild {
34    fn from(props: MenuGroupProperties) -> Self {
35        MenuChild::Group(Rc::new(props))
36    }
37}
38
39impl From<MenuLoadingProperties> for MenuChild {
40    fn from(props: MenuLoadingProperties) -> Self {
41        MenuChild::Loading(Rc::new(props))
42    }
43}
44
45impl From<ChildrenProperties> for MenuChild {
46    fn from(props: ChildrenProperties) -> Self {
47        MenuChild::Raw(Rc::new(props))
48    }
49}