jinya_ui/widgets/form/
label.rs1use yew::prelude::*;
2use yew::{Component, ComponentLink, Html};
3
4pub fn get_css() -> &'static str {
5 "
7.jinya-label {
8 flex: 0 0 100%;
9}
10"
11}
12
13pub struct Label {
14 label: String,
15}
16
17#[derive(Clone, PartialEq, Properties)]
18pub struct LabelProps {
19 pub label: String,
20}
21
22impl Component for Label {
23 type Message = ();
24 type Properties = LabelProps;
25
26 fn create(props: Self::Properties, _link: ComponentLink<Self>) -> Self {
27 Label { label: props.label }
28 }
29
30 fn update(&mut self, _msg: Self::Message) -> bool {
31 false
32 }
33
34 fn change(&mut self, props: Self::Properties) -> bool {
35 self.label = props.label;
36
37 true
38 }
39
40 fn view(&self) -> Html {
41 html! {
42 <label class="jinya-label">{&self.label}</label>
43 }
44 }
45}