Bulma now has some input boxes.

master
Philippe Pittoli 2023-06-09 00:28:03 +02:00
parent 48a9a55533
commit 4d73afa642
2 changed files with 32 additions and 38 deletions

View File

@ -223,41 +223,14 @@ render {
, render_register_form , render_register_form
] ]
render_input password placeholder action value validity cond
= HH.input $
[ HE.onValueInput action
, HP.value value
, HP.placeholder placeholder
, Bulma.input_classes validity
, cond
] <> case password of
false -> []
true -> [ HP.type_ HP.InputPassword ]
box_input title placeholder action value validity cond
= HH.label [ ]
[ HH.label [HP.classes Bulma.class_label ] [ HH.text title ]
, HH.div [HP.classes Bulma.class_control ] [ render_input false placeholder action value validity cond ]
]
box_password title placeholder action value validity cond
= HH.label [ ]
[ HH.label [HP.classes Bulma.class_label ] [ HH.text title ]
, HH.div [HP.classes Bulma.class_control ] [ render_input true placeholder action value validity cond ]
]
render_auth_form = HH.form render_auth_form = HH.form
[ HE.onSubmit AuthenticationAttempt ] [ HE.onSubmit AuthenticationAttempt ]
[ box_input [ Bulma.box_input "Login" "login" -- title, placeholder
"Login" -- title
"login" -- placeholder
(HandleAuthenticationInput <<< AUTH_INP_login) -- action (HandleAuthenticationInput <<< AUTH_INP_login) -- action
authenticationForm.login -- value authenticationForm.login -- value
true -- validity (TODO) true -- validity (TODO)
(maybe (HP.disabled true) (\_ -> HP.enabled true) wsConnection) -- condition (maybe (HP.disabled true) (\_ -> HP.enabled true) wsConnection) -- condition
, box_password , Bulma.box_password "Password" "password" -- title, placeholder
"Password" -- title
"password" -- placeholder
(HandleAuthenticationInput <<< AUTH_INP_pass) -- action (HandleAuthenticationInput <<< AUTH_INP_pass) -- action
authenticationForm.pass -- value authenticationForm.pass -- value
true -- validity (TODO) true -- validity (TODO)

View File

@ -285,7 +285,7 @@ box_input_password action password validity = HH.label [ ]
-- _ -> HE.onClick \_ -> action2 -- _ -> HE.onClick \_ -> action2
btn :: forall w i. i -> i -> Boolean -> HH.HTML w i btn :: forall w i. String -> i -> i -> Boolean -> HH.HTML w i
btn title action1 action2 validity btn title action1 action2 validity
= HH.button = HH.button
[ btn_add_action validity [ btn_add_action validity
@ -296,6 +296,27 @@ btn title action1 action2 validity
true -> HE.onClick \_ -> action1 true -> HE.onClick \_ -> action1
_ -> HE.onClick \_ -> action2 _ -> HE.onClick \_ -> action2
render_input password placeholder action value validity cond
= HH.input $
[ HE.onValueInput action
, HP.value value
, HP.placeholder placeholder
, input_classes validity
, cond
] <> case password of
false -> []
true -> [ HP.type_ HP.InputPassword ]
box_inner ispassword title placeholder action value validity cond
= HH.label [ ]
[ HH.label [HP.classes class_label ] [ HH.text title ]
, HH.div [HP.classes class_control ]
[ render_input ispassword placeholder action value validity cond ]
]
box_input = box_inner false
box_password = box_inner true
p :: forall w i. String -> HH.HTML w i p :: forall w i. String -> HH.HTML w i
p str = HH.p_ [ HH.text str ] p str = HH.p_ [ HH.text str ]