diff --git a/README.md b/README.md index dc8abea..3b1dfff 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Roadmap - [ ] [Spinner](https://blueprintjs.com/docs/#core/components/spinner) - [ ] [Tabs](https://blueprintjs.com/docs/#core/components/tabs) - [ ] [Tag](https://blueprintjs.com/docs/#core/components/tag) - - [ ] [Text](https://blueprintjs.com/docs/#core/components/text) + - [x] [Text](https://blueprintjs.com/docs/#core/components/text) - [x] [Tree](https://blueprintjs.com/docs/#core/components/tree) - depends on: Collapse, Icon - [ ] [FormGroup](https://blueprintjs.com/docs/#core/components/form-group) diff --git a/src/forms/mod.rs b/src/forms/mod.rs index 1a8fe5f..11d1711 100644 --- a/src/forms/mod.rs +++ b/src/forms/mod.rs @@ -1 +1,2 @@ pub mod controls; +pub mod text; diff --git a/src/forms/text.rs b/src/forms/text.rs new file mode 100644 index 0000000..d2e7f34 --- /dev/null +++ b/src/forms/text.rs @@ -0,0 +1,93 @@ +use yew::prelude::*; + +pub struct Text { + props: Props, +} + +#[derive(Clone, PartialEq, Properties)] +pub struct Props { + #[prop_or_default] + pub value: String, + #[prop_or_default] + pub oninput:Callback +} + + +impl Component for Text { + type Message = (); + type Properties = Props; + + fn create(props: Self::Properties, _link: ComponentLink) -> Self { + Text { props } + } + + fn update(&mut self, _msg: Self::Message) -> ShouldRender { + true + } + + fn change(&mut self, props: Self::Properties) -> ShouldRender { + if self.props != props { + self.props = props; + true + } else { + false + } + } + + fn view(&self) -> Html { + html! { +