input_with_side_text

beta
Philippe Pittoli 2024-02-15 23:23:24 +01:00
parent 8f16222114
commit 6abd592aa5
3 changed files with 39 additions and 11 deletions

View File

@ -303,10 +303,14 @@ render state
content_simple :: Array (HH.HTML w Action)
content_simple =
[ render_errors
, Bulma.box_input ("domain" <> state._currentRR.rrtype) "Name" "www" -- id, title, placeholder
--, Bulma.box_input ("domain" <> state._currentRR.rrtype) "Name" "www" -- id, title, placeholder
-- (updateForm Field_Domain) -- action
-- state._currentRR.name -- value
-- should_be_disabled -- condition
, Bulma.input_with_side_text ("domain" <> state._currentRR.rrtype) "Name" "www" -- id, title, placeholder
(updateForm Field_Domain) -- action
state._currentRR.name -- value
should_be_disabled -- condition
state._currentRR.name -- value
("." <> state._domain) -- sidetext
, Bulma.box_input ("ttl" <> state._currentRR.rrtype) "TTL" "600"
(updateForm Field_TTL)
(show state._currentRR.ttl)
@ -319,10 +323,10 @@ render state
content_mx :: Array (HH.HTML w Action)
content_mx =
[ render_errors
, Bulma.box_input ("domainMX") "Name" "mail" -- id, title, placeholder
(updateForm Field_Domain) -- action
state._currentRR.name -- value
should_be_disabled -- condition
, Bulma.input_with_side_text "domainMX" "Name" "www" -- id, title, placeholder
(updateForm Field_Domain) -- action
state._currentRR.name -- value
("." <> state._domain) -- sidetext
, Bulma.box_input ("ttlMX") "TTL" "600"
(updateForm Field_TTL)
(show state._currentRR.ttl)
@ -339,10 +343,10 @@ render state
content_srv :: Array (HH.HTML w Action)
content_srv =
[ render_errors
, Bulma.box_input ("domainSRV") "Name" "_sip._tcp" -- id, title, placeholder
(updateForm Field_Domain) -- action
state._currentRR.name -- value
should_be_disabled -- condition
, Bulma.input_with_side_text "domainSRV" "Name" "www" -- id, title, placeholder
(updateForm Field_Domain) -- action
state._currentRR.name -- value
("." <> state._domain) -- sidetext
, Bulma.box_input ("ttlSRV") "TTL" "600"
(updateForm Field_TTL)
(show state._currentRR.ttl)

View File

@ -389,3 +389,25 @@ 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
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_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.p [HP.classes C.control]
[ HH.a [HP.classes $ C.button <> C.is_small <> C.is_static]
[HH.text sidetext] ]
]
]

View File

@ -92,6 +92,8 @@ is_small :: Array HH.ClassName
is_small = [HH.ClassName "is-small"]
is_success :: Array HH.ClassName
is_success = [HH.ClassName "is-success"]
is_static :: Array HH.ClassName
is_static = [HH.ClassName "is-static"]
label :: Array HH.ClassName
label = [HH.ClassName "label"]
level :: Array HH.ClassName