-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasefn__Input.res
More file actions
48 lines (41 loc) · 967 Bytes
/
Basefn__Input.res
File metadata and controls
48 lines (41 loc) · 967 Bytes
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
open Xote
%%raw(`import './Basefn__Input.css'`)
type inputType = Text | Email | Password | Number | Tel | Url | Search | Date | Time
type inputSize = Sm | Md
type radius = Full | Md
let inputTypeToString = (type_: inputType) => {
switch type_ {
| Text => "text"
| Email => "email"
| Password => "password"
| Number => "number"
| Tel => "tel"
| Url => "url"
| Search => "search"
| Date => "date"
| Time => "time"
}
}
@jsx.component
let make = (
~value: ReactiveProp.t<string>,
~onInput: option<Dom.event => unit>=?,
~type_: inputType=Text,
~placeholder: string="",
~disabled=ReactiveProp.static(false),
~size=Md,
~radius=Md,
~name=?,
~style=?,
) => {
let class = {
let radiusClass = switch radius {
| Full => "basefn-input--radius-full"
| _ => ""
}
"basefn-input " ++ radiusClass
}
<input
class ?style type_={inputTypeToString(type_)} placeholder value={value} disabled name ?onInput
/>
}