diff options
Diffstat (limited to 'js/content.ml')
-rw-r--r-- | js/content.ml | 40 |
1 files changed, 8 insertions, 32 deletions
diff --git a/js/content.ml b/js/content.ml index b666c37..7096524 100644 --- a/js/content.ml +++ b/js/content.ml @@ -1,30 +1,5 @@ module OptionInfix = Operators.Binding (Option) -let add_field : label:Jstr.t -> id':Jstr.t -> value':Jstr.t -> Brr.El.t = - fun ~label ~id' ~value' -> - Brr.El.div - ~at:Brr.At.[ class' (Jstr.v "field is-horizontal") ] - [ - Brr.El.label - ~at:Brr.At.[ for' id'; class' (Jstr.v "field-label is-normal") ] - [ Brr.El.txt label ]; - Brr.El.div - ~at:Brr.At.[ class' (Jstr.v "field-body") ] - [ - Brr.El.input - ~at: - Brr.At. - [ - class' (Jstr.v "input"); - type' (Jstr.v "text"); - name id'; - id id'; - value value'; - ] - (); - ]; - ] - module State = struct type t = { word : string; len : int; counter : int } @@ -50,12 +25,12 @@ module State = struct [ Brr.El.form [ - add_field ~id':(Jstr.v "text_state") - ~label:(Jstr.v "Word received") ~value':(Jstr.v word); - add_field ~id':(Jstr.v "nbcar_state") - ~label:(Jstr.v "Nb of car") ~value':(Jstr.of_int len); - add_field ~id':(Jstr.v "counter_state") - ~label:(Jstr.v "Request sent") ~value':(Jstr.of_int counter); + Elements.input_field ~label:(Jstr.v "Word received") + ~value':(Jstr.v word) (); + Elements.input_field ~label:(Jstr.v "Nb of car") + ~value':(Jstr.of_int len) (); + Elements.input_field ~label:(Jstr.v "Request sent") + ~value':(Jstr.of_int counter) (); ]; ]; ]; @@ -91,7 +66,8 @@ let main () = let form = Brr.El.form [ - add_field ~id':(Jstr.v "text") ~label:(Jstr.v "Text") ~value':Jstr.empty; + Elements.input_field ~name:(Jstr.v "text") ~id':(Jstr.v "text") + ~label:(Jstr.v "Text") (); Brr.El.div ~at:Brr.At.[ class' (Jstr.v "field is-horizontal") ] [ |