aboutsummaryrefslogtreecommitdiff
path: root/editor/forms/add_page.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-04-29 15:20:11 +0200
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:43:33 +0100
commit2fc4e793b12341df6264e22c0b8bd0f6dd2bd27d (patch)
treeb61b55dc11e4361927c1638d1eb4e82feeef5465 /editor/forms/add_page.ml
parenteb319516fd922ab89b7120a885d1e801fa3f45aa (diff)
Added pop-up and events in editor
Diffstat (limited to 'editor/forms/add_page.ml')
-rwxr-xr-xeditor/forms/add_page.ml36
1 files changed, 36 insertions, 0 deletions
diff --git a/editor/forms/add_page.ml b/editor/forms/add_page.ml
new file mode 100755
index 0000000..597e9d3
--- /dev/null
+++ b/editor/forms/add_page.ml
@@ -0,0 +1,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 ]
+ ]
+ ] )