Style, again. Improved DomainList UI.

beta
Philippe Pittoli 2023-07-05 07:00:42 +02:00
parent de52e40036
commit 9f4600b1e8
2 changed files with 12 additions and 30 deletions

View File

@ -120,24 +120,19 @@ render { accepted_domains, my_domains, newDomainForm, wsUp }
, HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) my_domains , HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) my_domains
] ]
-- should_be_disabled = (maybe (HP.disabled true) (\_ -> HP.enabled true) wsInfo.connection)
should_be_disabled = (if wsUp then (HP.enabled true) else (HP.disabled true))
domain_buttons domain domain_buttons domain
= [ HH.button = [ HH.button
[ HP.style "padding: 0.5rem 1.25rem;" [ HP.type_ HP.ButtonSubmit
, HP.type_ HP.ButtonSubmit
, HE.onClick \_ -> EnterDomain domain
, (if wsUp then (HP.enabled true) else (HP.disabled true))
]
[ HH.text domain ]
, HH.button
[ HP.style "padding: 0.5rem 1.25rem;"
, HP.type_ HP.ButtonSubmit
, HE.onClick \_ -> RemoveDomain domain , HE.onClick \_ -> RemoveDomain domain
, (if wsUp then (HP.enabled true) else (HP.disabled true)) , HP.classes Bulma.class_button
] ]
[ HH.text "x" ] [ HH.text "x" ]
, HH.button
[ HP.type_ HP.ButtonSubmit
, HE.onClick \_ -> EnterDomain domain
, HP.classes Bulma.class_button
]
[ HH.text domain ]
] ]
render_adduser_form = HH.form render_adduser_form = HH.form
@ -148,23 +143,7 @@ render { accepted_domains, my_domains, newDomainForm, wsUp }
[ HHE.onSelectedIndexChange domain_choice ] [ HHE.onSelectedIndexChange domain_choice ]
accepted_domains accepted_domains
] ]
--[ Bulma.box_input "Your new domain" "awesomewebsite" -- title, placeholder
-- (HandleNewDomainInput <<< INP_newdomain) -- action
-- newDomainForm.new_domain -- value
-- true -- validity (TODO)
-- should_be_disabled -- condition
--, domain_selection
--, HH.div_
-- [ HH.button
-- [ HP.style "padding: 0.5rem 1.25rem;"
-- , HP.type_ HP.ButtonSubmit
-- , (if wsUp then (HP.enabled true) else (HP.disabled true))
-- ]
-- [ HH.text "Send Message to Server" ]
-- ]
--]
domain_selection = Bulma.select [ HHE.onSelectedIndexChange domain_choice ] $ map Bulma.option accepted_domains
domain_choice :: Int -> Action domain_choice :: Int -> Action
domain_choice i domain_choice i
= HandleNewDomainInput <<< UpdateSelectedDomain $ maybe default_domain (\x -> x) $ accepted_domains A.!! i = HandleNewDomainInput <<< UpdateSelectedDomain $ maybe default_domain (\x -> x) $ accepted_domains A.!! i

View File

@ -351,6 +351,9 @@ field classes = HH.div [ HP.classes (class_field <> classes) ]
class_input :: Array (HH.ClassName) class_input :: Array (HH.ClassName)
class_input = [HH.ClassName "input" ] class_input = [HH.ClassName "input" ]
class_button :: Array (HH.ClassName)
class_button = [HH.ClassName "button" ]
new_domain_field inputaction text selectaction accepted_domains new_domain_field inputaction text selectaction accepted_domains
= field class_has_addons = field class_has_addons
[ HH.p [ HH.p
@ -370,7 +373,7 @@ new_domain_field inputaction text selectaction accepted_domains
[ HP.classes class_control ] [ HP.classes class_control ]
[ HH.button [ HH.button
[ HP.type_ HP.ButtonSubmit [ HP.type_ HP.ButtonSubmit
, HP.classes class_primary , HP.classes class_button
] ]
[ HH.text "add a new domain!" ] [ HH.text "add a new domain!" ]
] ]