From 9f4600b1e8288e309d4fe67fe08752fff9b35206 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Wed, 5 Jul 2023 07:00:42 +0200 Subject: [PATCH] Style, again. Improved DomainList UI. --- src/App/DomainListInterface.purs | 37 +++++++------------------------- src/Bulma.purs | 5 ++++- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/App/DomainListInterface.purs b/src/App/DomainListInterface.purs index ad7239d..e93b2cc 100644 --- a/src/App/DomainListInterface.purs +++ b/src/App/DomainListInterface.purs @@ -120,24 +120,19 @@ render { accepted_domains, my_domains, newDomainForm, wsUp } , 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 = [ HH.button - [ HP.style "padding: 0.5rem 1.25rem;" - , 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 + [ HP.type_ HP.ButtonSubmit , HE.onClick \_ -> RemoveDomain domain - , (if wsUp then (HP.enabled true) else (HP.disabled true)) + , HP.classes Bulma.class_button ] [ 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 @@ -148,23 +143,7 @@ render { accepted_domains, my_domains, newDomainForm, wsUp } [ HHE.onSelectedIndexChange domain_choice ] 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 i = HandleNewDomainInput <<< UpdateSelectedDomain $ maybe default_domain (\x -> x) $ accepted_domains A.!! i diff --git a/src/Bulma.purs b/src/Bulma.purs index 6a5637a..516eaad 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -351,6 +351,9 @@ field classes = HH.div [ HP.classes (class_field <> classes) ] class_input :: Array (HH.ClassName) class_input = [HH.ClassName "input" ] +class_button :: Array (HH.ClassName) +class_button = [HH.ClassName "button" ] + new_domain_field inputaction text selectaction accepted_domains = field class_has_addons [ HH.p @@ -370,7 +373,7 @@ new_domain_field inputaction text selectaction accepted_domains [ HP.classes class_control ] [ HH.button [ HP.type_ HP.ButtonSubmit - , HP.classes class_primary + , HP.classes class_button ] [ HH.text "add a new domain!" ] ]