aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/Login.elm
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/Login.elm')
-rw-r--r--frontend/src/Login.elm41
1 files changed, 30 insertions, 11 deletions
diff --git a/frontend/src/Login.elm b/frontend/src/Login.elm
index dd168f0..87657bb 100644
--- a/frontend/src/Login.elm
+++ b/frontend/src/Login.elm
@@ -2,11 +2,15 @@ module Login exposing (..)
2 2
3import Browser 3import Browser
4import Browser.Navigation as Nav 4import Browser.Navigation as Nav
5import Html exposing (..) 5import Css exposing (..)
6import Html.Attributes exposing (..) 6import Html
7import Html.Events exposing (..) 7import Html.Styled exposing (..)
8import Html.Styled.Attributes exposing (..)
9import Html.Styled.Events exposing (..)
8import Http 10import Http
11import Icons exposing (..)
9import Json.Encode as Encode 12import Json.Encode as Encode
13import Styles exposing (..)
10import Url 14import Url
11import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string) 15import Url.Parser as P exposing ((</>), Parser, int, oneOf, s, string)
12 16
@@ -91,7 +95,7 @@ viewStatus : LoginStatus -> String
91viewStatus ls = 95viewStatus ls =
92 case ls of 96 case ls of
93 NotLoggedIn -> 97 NotLoggedIn ->
94 "Not Logged In" 98 ""
95 99
96 InvalidLogin -> 100 InvalidLogin ->
97 "Invalid Login" 101 "Invalid Login"
@@ -105,15 +109,30 @@ viewStatus ls =
105 109
106viewInput : String -> String -> String -> (String -> msg) -> Html msg 110viewInput : String -> String -> String -> (String -> msg) -> Html msg
107viewInput t p v toMsg = 111viewInput t p v toMsg =
108 input [ type_ t, placeholder p, value v, onInput toMsg ] [] 112 loginInputField [ type_ t, placeholder p, value v, onInput toMsg ] []
113
114
115fieldPadding =
116 css
117 [ paddingTop (px 10)
118 , paddingBottom (px 10)
119 ]
109 120
110 121
111view : Model -> Html Msg 122view : Model -> Html Msg
112view model = 123view model =
113 div [] 124 div
114 [ div [] [ viewInput "text" "Enter name here" model.username UserEntered ] 125 [ css
115 , div [] [ viewInput "password" "Password" model.password PassEntered ] 126 [ margin auto
116 , div [] [ button [ onClick LoginPressed ] [ text "Login" ] ] 127 , marginTop (pct 10)
117 , div [] [ text (viewStatus model.loginStatus) ] 128 , padding (px 20)
118 , div [] [ text "Don't have an account? ", a [ href "/signup" ] [ text "Register now!" ] ] 129 , Css.width (pct 30)
130 ]
131 ]
132 [ div [ fieldPadding, css [ bigHeading ] ] [ text "Login" ]
133 , div [ fieldPadding ] [ viewInput "text" "Enter name here" model.username UserEntered ]
134 , div [ fieldPadding ] [ viewInput "password" "Password" model.password PassEntered ]
135 , div [ css [ textAlign center ], fieldPadding ] [ furbyButton [ onClick LoginPressed ] [ text "Login" ] ]
136 , div [ css [ textAlign center ] ] [ text (viewStatus model.loginStatus) ]
137 , div [ fieldPadding ] [ text "Don't have an account? ", a [ href "/signup" ] [ text "Register now!" ] ]
119 ] 138 ]