design_system/button/
button.rs1use css_in_rust::Style;
2use yew::prelude::*;
3
4use yew_styles::button::{Button as Btn, Props, Msg};
5
6pub struct Button {
7 link: ComponentLink<Self>,
8 props: Props,
13}
14
15impl Component for Button {
31 type Message = Msg;
32 type Properties = Props;
33
34 fn create(props: Self::Properties, link: ComponentLink<Self>) -> Self {
35 Button {
39 props,
40 link
41 }
42 }
43
44 fn update(&mut self, msg: Self::Message) -> ShouldRender {
45 match msg {
46 Msg::Clicked(mouse_event) => {
47 self.props.onclick_signal.emit(mouse_event);
48 }
49 };
50 true
51 }
52
53 fn change(&mut self, props: Self::Properties) -> ShouldRender {
54
55 true
56 }
57
58 fn view(&self) -> Html {
59 html! {
60 <Btn
61 onclick_signal=self.link.callback(Msg::Clicked)
62 > { self.props.children.clone() }
63 </Btn>
64 }
65 }
66}