zuicon_mdl2/
number_field.rs1use yew::prelude::{html, Component, Context, Html, Properties};
8
9pub struct NumberField {}
10
11#[derive(Properties, Debug, Clone, PartialEq, Eq)]
12pub struct Props {
13 #[prop_or_default]
14 pub class: Option<&'static str>,
15
16 #[prop_or_default]
17 pub width: Option<&'static str>,
18
19 #[prop_or_default]
20 pub height: Option<&'static str>,
21
22 #[prop_or_default]
23 pub color: Option<&'static str>,
24
25 #[prop_or_default]
26 pub fill: Option<&'static str>,
27
28 #[prop_or_default]
29 pub spin: bool,
30
31 #[prop_or_default]
32 pub rotate: i16,
33}
34
35impl Component for NumberField {
36 type Properties = Props;
37 type Message = ();
38
39 fn create(_ctx: &Context<Self>) -> Self {
40 Self {}
41 }
42
43 fn view(&self, ctx: &Context<Self>) -> Html {
44 let props = ctx.props();
45 let mut style = String::new();
47 if props.rotate != 0 {
48 style += &format!("transform: rotate({}deg);", props.rotate);
49 }
50 html! {
51 <svg
52 xmlns={ "http://www.w3.org/2000/svg" }
53 class={ props.class.unwrap_or("") }
54 width={ props.width.unwrap_or("16") }
55 height={ props.height.unwrap_or("16") }
56 focusable={ "false" }
57 data-icon={ "NumberField" }
58 viewBox={ "0 0 16 16" }
59 fill={ props.fill.unwrap_or("currentColor") }
60 style={ style }
61 >
62 <path d="M1024 1280H640v-75q0-38 14-73 11-28 33-54t50-53 55-50 51-49 38-47 15-47q0-26-19-45t-45-19q-23 0-40 14t-23 37l-125-26q6-33 23-61t44-48 57-32 64-12q40 0 75 15t61 41 41 61 15 75q0 39-11 70t-31 58-44 51-51 46-51 46-47 49h235v128zM2048 256v1408H0V256h2048zm-128 128H128v1152h1792V384zM397 787q-29 17-68 31t-73 14V704q11 0 31-6t40-15 36-21 22-22h127v640H397V787zm923 493q-42 0-81-14t-75-37v-127q20 15 35 26t32 18 34 10 45 3q22 0 42-4t35-15 25-28 9-42q0-31-24-44t-56-18-65-3-53 2v-97h58q31 0 58-7t45-26 18-57q0-42-25-56t-64-14q-40 0-69 18t-58 43V681q34-23 76-32t82-9q36 0 70 10t60 29 43 49 16 69q0 48-19 85t-62 61q44 15 72 53t28 85q0 47-20 84t-52 62-75 39-85 14z" />
63 </svg>
64 }
65 }
66}