From 61f7ef65bd8abacfacf87154b652a25c475b2664 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sat, 16 Nov 2024 06:21:52 +0100 Subject: [PATCH] WIP: integrating autocomplete web browser features. --- src/App/Page/Registration.purs | 6 +----- src/Bulma.purs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/App/Page/Registration.purs b/src/App/Page/Registration.purs index fe4a20d..fca82dc 100644 --- a/src/App/Page/Registration.purs +++ b/src/App/Page/Registration.purs @@ -109,11 +109,7 @@ render { registrationForm } password_input <> password_error <> legal_mentions <> validation_btn) - login_input - = [ Bulma.box_input "loginREGISTER" "Login" "login" -- title, placeholder - (HandleRegisterInput <<< REG_INP_login) -- action - registrationForm.login -- value - ] + login_input = [ Bulma.login_input "Login" registrationForm.login (HandleRegisterInput <<< REG_INP_login) ] login_error = case between 0 1 (S.length registrationForm.login), L.login registrationForm.login of diff --git a/src/Bulma.purs b/src/Bulma.purs index 8c3d5d9..c3eebf4 100644 --- a/src/Bulma.purs +++ b/src/Bulma.purs @@ -1,6 +1,6 @@ -- | The `Bulma` module is a wrapper around the BULMA css framework. module Bulma where -import Prelude +import Prelude (class Show, map, show, ($), (<>), (==)) import Data.Maybe (Maybe, fromMaybe) import Data.Tuple (Tuple, fst, snd) @@ -10,6 +10,7 @@ import Halogen.HTML.Properties as HP import Halogen.HTML.Events as HE import MissingHTMLProperties as MissingProperties +import DOM.HTML.Indexed.AutocompleteType (AutocompleteType(..)) import CSSClasses as C import Halogen.HTML.Core (AttrName(..)) @@ -542,6 +543,22 @@ box_password_ = field_inner true box_input :: forall w i. String -> String -> String -> (String -> i) -> String -> HH.HTML w i box_input = box_input_ (HP.enabled true) +login_input :: forall w i. String -> String -> (String -> i) -> HH.HTML w i +login_input title value action + = div_field [] + [ div_field_label "username" title + , div_field_content $ HH.input + [ HE.onValueInput action + , MissingProperties.ty "text" + , HP.value value + , HP.name "username" + , HP.autocomplete AutocompleteUsername + , HP.placeholder "Username" + , HP.id "username" + , HP.classes input_classes + ] + ] + box_password :: forall w i. String -> String -> String -> (String -> i) -> String -> HH.HTML w i box_password = box_password_ (HP.enabled true)