aboutsummaryrefslogtreecommitdiff
path: root/editor/forms/add_page.ml
blob: 597e9d3cd102c6f310edd892112cba5503e0c617 (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
open Note

type Events.kind +=
  | AddPage of { title : Jstr.t }

let create
  : unit -> Events.t
  = fun () ->

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

    let state =
      S.hold (AddPage { title = Jstr.empty })
      @@ Evr.on_el
        (Ev.input)
        (fun _ ->
           AddPage { 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 ]
            ]
        ] )