summaryrefslogtreecommitdiff
path: root/src/util.rs
blob: 3d8f231efb1d0c4c0eb7eb6b345a7a68a5919da7 (plain)
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
use yew::prelude::*;

pub fn text_field_input(label: &str, id: &str, placeholder: Option<&str>, oninput: Callback<InputData>) -> Html {
    html!{
        <div class="field column 
                    is-one-fifth-widescreen
                    is-one-quarter-desktop
                    is-one-third-tablet
                    is-half-mobile" >
            <label class="label">{ label }</label>
            <div class="control">
                <input  id=id
                        type="text" 
                        placeholder=placeholder.unwrap_or("")
                        oninput=oninput
                />
            </div>
        </div>
    }
}

pub fn checkbox_field_input(label: &str, id: &str, checked: bool, onclick: Callback<MouseEvent>) -> Html {
    html!{
        <div class="field column 
                    is-one-fifth-widescreen 
                    is-one-quarter-desktop 
                    is-one-third-tablet 
                    is-half-mobile" >
            <label class="checkbox">
                <input  id=id
                        type="checkbox" 
                        checked=checked
                        onclick=onclick
                />
                { label }
            </label>
        </div>
    }
}