Bulma: textarea.

dev
Philippe Pittoli 2024-03-13 20:11:13 +01:00
parent 38e519125f
commit 547a22f6dd
1 changed files with 7 additions and 10 deletions

View File

@ -170,21 +170,18 @@ txt_name t
rr_name_style = HP.style "width: 80px;"
rr_name_text = HH.text t
-- | For textareas I don't use Bulma's "textarea" class since it doesn't allow to expand
-- | textareas horizontaly, which makes edition of TXT records painful.
textarea_classes :: Boolean -> Array HH.ClassName
textarea_classes true = C.input <> C.is_small <> C.is_info
textarea_classes false = C.input <> C.is_small <> C.is_danger
textarea :: forall w i. (String -> i) -> String -> Boolean -> HH.HTML w i
textarea action value validity
textarea_ :: forall w i. Array HH.ClassName -> String -> String -> (String -> i) -> HH.HTML w i
textarea_ classes placeholder value action
= HH.textarea
[ HE.onValueInput action
, HP.value value
, HP.placeholder "target"
, HP.classes $ textarea_classes validity
, HP.placeholder placeholder
, HP.classes $ C.textarea <> classes
]
textarea :: forall w i. String -> String -> (String -> i) -> HH.HTML w i
textarea placeholder value action = textarea_ [] placeholder value action
btn_modify :: forall w i. i -> HH.HTML w i
btn_modify action = btn_ (C.is_small <> C.is_info) "⚒" action