diff --git a/src/App/Page/Authentication.purs b/src/App/Page/Authentication.purs index 29195d4..04d5b30 100644 --- a/src/App/Page/Authentication.purs +++ b/src/App/Page/Authentication.purs @@ -230,12 +230,8 @@ render { wsUp, current_tab, authenticationForm, passwordRecoveryForm, newPasswor (HandleAuthenticationInput <<< AUTH_INP_pass) -- action authenticationForm.pass -- value should_be_disabled -- condition - , 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" ] + , Bulma.btn_validation + ] render_password_recovery_form = HH.form @@ -248,12 +244,7 @@ render { wsUp, current_tab, authenticationForm, passwordRecoveryForm, newPasswor (HandlePasswordRecovery <<< PASSR_INP_email) -- action passwordRecoveryForm.email -- value should_be_disabled -- condition - , 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" ] + , Bulma.btn_validation ] render_new_password_form = HH.form @@ -274,12 +265,7 @@ render { wsUp, current_tab, authenticationForm, passwordRecoveryForm, newPasswor (HandleNewPassword <<< NEWPASS_INP_confirmation) newPasswordForm.confirmation should_be_disabled - , 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" ] + , Bulma.btn_validation ] diff --git a/src/App/Page/DomainList.purs b/src/App/Page/DomainList.purs index 4c588ef..23a08bf 100644 --- a/src/App/Page/DomainList.purs +++ b/src/App/Page/DomainList.purs @@ -23,7 +23,6 @@ import Halogen as H import Halogen.HTML as HH import Halogen.HTML.Events as HE import Halogen.HTML.Events as HHE -import Halogen.HTML.Properties as HP import Web.Event.Event as Event import Web.Event.Event (Event) import Bulma as Bulma @@ -32,7 +31,6 @@ import App.DisplayErrors (error_to_paragraph_label) import App.Validation.Label as Validation -import CSSClasses as C import App.Type.LogMessage import App.Message.DNSManagerDaemon as DNSManager @@ -164,7 +162,7 @@ render { accepted_domains, my_domains, newDomainForm, wsUp, active_modal } false -> Bulma.p "You are disconnected." true -> case active_modal of Nothing -> Bulma.columns_ - [ Bulma.column_ [ Bulma.h3 "Add a domain!", render_add_domain_form] + [ Bulma.column_ [ Bulma.h3 "New domain", render_add_domain_form] , Bulma.column_ [ Bulma.h3 "My domains" , HH.ul_ $ map (\domain -> HH.li_ (domain_buttons domain)) my_domains ] @@ -194,12 +192,8 @@ render { accepted_domains, my_domains, newDomainForm, wsUp, active_modal } (HandleNewDomainInput <<< INP_newdomain) newDomainForm.new_domain [ HHE.onSelectedIndexChange domain_choice ] - accepted_domains - , HH.button - [ HP.type_ HP.ButtonSubmit - , HP.classes C.button - ] - [ HH.text "add a new domain!" ] + (map (\v -> "." <> v) accepted_domains) + , Bulma.btn_validation_ "add a new domain" , if A.length newDomainForm._errors > 0 then HH.div_ $ map error_to_paragraph_label newDomainForm._errors else HH.div_ [ ] diff --git a/src/App/Page/MailValidation.purs b/src/App/Page/MailValidation.purs index 1346aee..49ac959 100644 --- a/src/App/Page/MailValidation.purs +++ b/src/App/Page/MailValidation.purs @@ -110,14 +110,7 @@ render { wsUp, mailValidationForm } (HandleValidationInput <<< VALIDATION_INP_token) -- action mailValidationForm.token -- value should_be_disabled -- condition - , 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" ] - ] + , Bulma.btn_validation ] handleAction :: forall m. MonadAff m => Action -> H.HalogenM State Action () Output m Unit diff --git a/src/App/Page/Registration.purs b/src/App/Page/Registration.purs index 3923eb7..dbc913d 100644 --- a/src/App/Page/Registration.purs +++ b/src/App/Page/Registration.purs @@ -117,14 +117,7 @@ render { wsUp, registrationForm } (HandleRegisterInput <<< REG_INP_pass) -- action registrationForm.pass -- value should_be_disabled -- condition - , 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" ] - ] + , Bulma.btn_validation ] handleAction :: forall m. MonadAff m => Action -> H.HalogenM State Action () Output m Unit diff --git a/src/Bulma.purs b/src/Bulma.purs index 84fc9e2..536121a 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -522,3 +522,14 @@ notification_primary value deleteaction = notification C.is_primary value delete notification_danger :: forall w i. String -> i -> HH.HTML w i notification_danger value deleteaction = notification C.is_danger value deleteaction + +btn_validation_ :: forall w i. String -> HH.HTML w i +btn_validation_ str = HH.button + -- [ HP.style "padding: 0.5rem 1.25rem;" + [ HP.type_ HP.ButtonSubmit + , HP.classes $ C.button <> C.is_primary + ] + [ HH.text str ] + +btn_validation :: forall w i. HH.HTML w i +btn_validation = btn_validation_ "Validate"