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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
use yew::prelude::*;
#[derive(Properties, Clone, Debug, PartialEq)]
pub struct DescriptionListProps {
#[prop_or_default]
pub children: Children,
}
pub struct DescriptionList {
props: DescriptionListProps,
}
impl Component for DescriptionList {
type Message = ();
type Properties = DescriptionListProps;
fn create(props: Self::Properties, _link: ComponentLink<Self>) -> Self {
Self { props }
}
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
false
}
fn change(&mut self, props: Self::Properties) -> ShouldRender {
if self.props != props {
self.props = props;
true
} else {
false
}
}
fn view(&self) -> Html {
let classes = Classes::from("pf-c-description-list");
return html! {
<dl class=classes>
{ for self.props.children.iter() }
</dl>
};
}
}
#[derive(Properties, Clone, Debug, PartialEq)]
pub struct DescriptionGroupProps {
pub term: String,
#[prop_or_default]
pub children: Children,
}
pub struct DescriptionGroup {
props: DescriptionGroupProps,
}
impl Component for DescriptionGroup {
type Message = ();
type Properties = DescriptionGroupProps;
fn create(props: Self::Properties, _link: ComponentLink<Self>) -> Self {
Self { props }
}
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
false
}
fn change(&mut self, props: Self::Properties) -> ShouldRender {
if self.props != props {
self.props = props;
true
} else {
false
}
}
fn view(&self) -> Html {
html! {
<div class="pf-c-description-list__group">
<dt class="pf-c-description-list__term">{&self.props.term}</dt>
<dd class="pf-c-description-list__description">
<div class="pf-c-description-list__text">
{ for self.props.children.iter() }
</div>
</dd>
</div>
}
}
}