aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View
diff options
context:
space:
mode:
authorJoris2016-01-02 20:31:25 +0100
committerJoris2016-01-02 20:31:25 +0100
commit302a2e798f10e61c129753a2bd11634420c1f1a1 (patch)
treeaa53c2eb212d0742f63b3df1be88afb5da699769 /src/client/elm/View
parentbb316286b0859b5648c61f44c88399f4c1aad9cd (diff)
Set a spinner for sign in
Diffstat (limited to 'src/client/elm/View')
-rw-r--r--src/client/elm/View/Icon.elm7
-rw-r--r--src/client/elm/View/SignIn.elm26
2 files changed, 17 insertions, 16 deletions
diff --git a/src/client/elm/View/Icon.elm b/src/client/elm/View/Icon.elm
index f22c1a2..9fa5f8a 100644
--- a/src/client/elm/View/Icon.elm
+++ b/src/client/elm/View/Icon.elm
@@ -1,5 +1,6 @@
module View.Icon
( renderIcon
+ , renderSpinIcon
) where
import Html exposing (..)
@@ -10,3 +11,9 @@ renderIcon iconClass =
i
[ class <| "fa fa-fw fa-" ++ iconClass ]
[]
+
+renderSpinIcon : String -> Html
+renderSpinIcon iconClass =
+ i
+ [ class <| "fa fa-fw fa-spin fa-" ++ iconClass ]
+ []
diff --git a/src/client/elm/View/SignIn.elm b/src/client/elm/View/SignIn.elm
index 6d253e7..f662a97 100644
--- a/src/client/elm/View/SignIn.elm
+++ b/src/client/elm/View/SignIn.elm
@@ -16,7 +16,7 @@ import Model.View.SignInView exposing (..)
import Model.Translations exposing (getMessage)
import View.Events exposing (onSubmitPrevDefault)
-import View.Icon exposing (renderIcon)
+import View.Icon exposing (..)
import Persona exposing (operations)
@@ -27,25 +27,19 @@ renderSignIn address model signInView =
[ button
[ onClick operations.address Persona.SignIn ]
[ span [] [ text (getMessage "SignIn" model.translations) ]
- , renderIcon "plug"
+ , if signInView.connecting
+ then renderSpinIcon "refresh"
+ else renderIcon "power-off"
]
- , div
- [ class "result" ]
- [ signInResult model signInView ]
+ , signInResult model signInView
]
signInResult : Model -> SignInView -> Html
signInResult model signInView =
- case signInView.result of
- Just result ->
- case result of
- Ok login ->
- div
- [ class "success" ]
- [ text (getMessage "SignInEmailSent" model.translations) ]
- Err error ->
- div
- [ class "error" ]
- [ text error ]
+ case signInView.error of
+ Just error ->
+ div
+ [ class "error" ]
+ [ text error ]
Nothing ->
text ""