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,45 +223,18 @@ 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 (HandleAuthenticationInput <<< AUTH_INP_login) -- action
"login" -- placeholder authenticationForm.login -- value
(HandleAuthenticationInput <<< AUTH_INP_login) -- action true -- validity (TODO)
authenticationForm.login -- value (maybe (HP.disabled true) (\_ -> HP.enabled true) wsConnection) -- condition
true -- validity (TODO) , Bulma.box_password "Password" "password" -- title, placeholder
(maybe (HP.disabled true) (\_ -> HP.enabled true) wsConnection) -- condition (HandleAuthenticationInput <<< AUTH_INP_pass) -- action
, box_password authenticationForm.pass -- value
"Password" -- title true -- validity (TODO)
"password" -- placeholder (maybe (HP.disabled true) (\_ -> HP.enabled true) wsConnection) -- condition
(HandleAuthenticationInput <<< AUTH_INP_pass) -- action
authenticationForm.pass -- value
true -- validity (TODO)
(maybe (HP.disabled true) (\_ -> HP.enabled true) wsConnection) -- condition
, HH.button , HH.button
[ HP.style "padding: 0.5rem 1.25rem;" [ HP.style "padding: 0.5rem 1.25rem;"
, HP.type_ HP.ButtonSubmit , HP.type_ HP.ButtonSubmit

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 ]