From 1cc6d57728b091fc73b2a24b76d9c140f5540742 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sat, 9 Nov 2024 16:34:13 +0100 Subject: [PATCH] Bulma: better documentation and fix some CSS. --- src/Bulma.purs | 52 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/src/Bulma.purs b/src/Bulma.purs index 25c92ac..593baf0 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -319,6 +319,16 @@ div_field_content content [ HH.div [HP.classes C.field ] [ HH.div [HP.classes C.control ] [ content ] ] ] -- | Basic field entry with a title and a field content. +-- | +-- |``` +-- |div [field is-horizontal] +-- | div [field-label is-normal] +-- | label [for-id] +-- | text +-- | div [field-body] +-- | div [field] +-- | div [control] +-- |``` field_entry :: forall w i. String -> String -> HH.HTML w i -> HH.HTML w i field_entry id title entry = div_field [] @@ -507,25 +517,43 @@ article head body = article_ [] head body error_message :: forall w i. HH.HTML w i -> HH.HTML w i -> HH.HTML w i error_message head body = article_ C.is_danger head body + +-- | Basic input field with a read-only side text. +-- | +-- |``` +-- |div [field is-horizontal] +-- | div [field-label normal] +-- | label [label for-id] +-- | text +-- | div [field-body] +-- | div [has-addons field] +-- | p [control] +-- | input +-- | p [control] +-- | a [button is-small is-static] +-- | text +-- |``` input_with_side_text :: forall w i. String -> String -> String -> (String -> i) -> String -> String -> HH.HTML w i input_with_side_text id title placeholder action value sidetext - = HH.div [HP.classes $ C.has_addons <> C.field <> C.is_horizontal] + = HH.div [HP.classes $ C.field <> C.is_horizontal] [ HH.div [ HP.classes (C.field_label <> C.normal) ] [HH.label [ HP.classes C.label, HP.for id ] [ HH.text title ]] , HH.div [ HP.classes C.field_body ] - [ HH.p [HP.classes C.control] - [ HH.input $ - [ HE.onValueInput action - , HP.value value - , HP.placeholder placeholder - , HP.classes $ input_classes - , HP.id id - ] + [ HH.div [ HP.classes $ C.has_addons <> C.field ] + [ HH.p [HP.classes C.control] + [ HH.input $ + [ HE.onValueInput action + , HP.value value + , HP.placeholder placeholder + , HP.classes $ input_classes + , HP.id id + ] + ] + , HH.p [HP.classes C.control] + [ HH.a [HP.classes $ C.button <> C.is_small <> C.is_static] + [HH.text sidetext] ] ] - , HH.p [HP.classes C.control] - [ HH.a [HP.classes $ C.button <> C.is_small <> C.is_static] - [HH.text sidetext] ] ] ]