Bulma: introduce some fields.

beta
Philippe Pittoli 2023-07-03 15:05:40 +02:00
parent 4522c22c42
commit b2caff5123
1 changed files with 30 additions and 8 deletions

View File

@ -300,6 +300,7 @@ btn title action1 action2 validity
true -> HE.onClick \_ -> action1
_ -> HE.onClick \_ -> action2
render_input password placeholder action value validity cond
= HH.input $
[ HE.onValueInput action
@ -311,15 +312,36 @@ render_input password placeholder action value validity cond
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 ]
]
class_horizontal :: Array (HH.ClassName)
class_horizontal = [HH.ClassName "is-horizontal" ]
class_normal :: Array (HH.ClassName)
class_normal = [HH.ClassName "is-normal" ]
class_field :: Array (HH.ClassName)
class_field = [HH.ClassName "field" ]
class_field_label :: Array (HH.ClassName)
class_field_label = [HH.ClassName "field-label" ]
class_field_body :: Array (HH.ClassName)
class_field_body = [HH.ClassName "field-body" ]
box_input = box_inner false
box_password = box_inner true
field_inner ispassword title placeholder action value validity cond
= div_field
[ div_field_label title
, div_field_content $ render_input ispassword placeholder action value validity cond
]
where
div_field = HH.div [ HP.classes (class_field <> class_horizontal) ]
div_field_label title
= HH.div [ HP.classes (class_field_label <> class_normal) ]
[HH.label [ HP.classes class_label ] [ HH.text title ]]
div_field_content content
= HH.div [HP.classes class_field_body]
[ HH.div [HP.classes class_field ]
[ HH.div [HP.classes class_control ] [ content ]
]
]
box_input = field_inner false
box_password = field_inner true
--box_button action value validity cond
-- = HH.label [ ]