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
use crate::Intent;
use yew::prelude::*;

#[derive(Clone, PartialEq, Properties)]
pub struct TextAreaProps {
    #[prop_or_default]
    pub class: Classes,
    #[prop_or_default]
    pub fill: bool,
    //TODO pub grow_vertically: bool,
    #[prop_or_default]
    pub r#ref: NodeRef,
    #[prop_or_default]
    pub intent: Option<Intent>,
    #[prop_or_default]
    pub large: bool,
    #[prop_or_default]
    pub small: bool,
    #[prop_or_default]
    pub onchange: Callback<Event>,
}

#[function_component(TextArea)]
pub fn text_area(
    TextAreaProps {
        class,
        fill,
        r#ref,
        intent,
        large,
        small,
        onchange,
    }: &TextAreaProps,
) -> Html {
    html! {
        <textarea
            class={classes!(
                "bp3-input",
                intent,
                fill.then_some("bp3-fill"),
                small.then_some("bp3-small"),
                large.then_some("bp3-large"),
                class.clone(),
            )}
            ref={r#ref}
            {onchange}
        />
    }
}