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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#![allow(unused_variables)]
#![allow(dead_code)]
use super::to_option;
use gloo::events::EventListener;
use wasm_bindgen::prelude::*;
use web_sys::Node;
use yew::prelude::*;
pub struct Radio {
props: RadioProps,
node_ref: NodeRef,
change_listener: Option<EventListener>,
}
#[derive(Clone, PartialEq, Properties)]
pub struct RadioProps {
#[prop_or_default]
pub checked: bool,
#[prop_or_default]
pub disabled: bool,
#[prop_or_default]
pub name: String,
#[prop_or_default]
pub value: String,
#[prop_or_default]
pub global: bool,
#[prop_or_default]
pub reduced_touch_target: bool,
#[prop_or_default]
pub onchange: Callback<bool>,
}
impl Component for Radio {
type Message = ();
type Properties = RadioProps;
fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self {
Self {
props,
node_ref: NodeRef::default(),
change_listener: None,
}
}
fn update(&mut self, _msg: Self::Message) -> ShouldRender {
false
}
fn change(&mut self, props: Self::Properties) -> bool {
if self.props != props {
self.props = props;
true
} else {
false
}
}
fn view(&self) -> Html {
html! {
<div class="mdc-radio">
<input class="mdc-radio__native-control" type="radio" id="radio-1" name="radios" />
<div class="mdc-radio__background">
<div class="mdc-radio__outer-circle"></div>
<div class="mdc-radio__inner-circle"></div>
</div>
<div class="mdc-radio__ripple"></div>
</div>
}
}
fn rendered(&mut self, first_render: bool) {
}
}