aboutsummaryrefslogtreecommitdiff
path: root/editor/forms/add_page.ml
blob: 5ec7f2f8ec3d8acaace25d158ba1a87611ba7d35 (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
open Brr
open Brr_note

type t = { title : Jstr.t }

let create
  : unit -> t Note.signal * El.t
  = fun () ->

    (* The element which contains the information *)
    let input = El.input ()
        ~at:At.[type' (Jstr.v "text") ]
    in

    let init =
      ( { title = Jstr.empty }
      ) in

    let state =
      Note.S.hold init
      @@ Evr.on_el
        (Ev.input)
        (fun _ -> { title = El.prop El.Prop.value input })
        input in

    ( state
    , El.div
        [ El.div ~at:At.[class' (Jstr.v "row")]
            [ El.div ~at:At.[class' (Jstr.v "col-25")]
                [ El.label [ El.txt' "Titre"]
                    ~at:[At.for' (Jstr.v "title")]
                ]
            ; El.div ~at:At.[class' (Jstr.v "col-75")]
                [ input ]
            ]
        ] )