From 302a2e798f10e61c129753a2bd11634420c1f1a1 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 2 Jan 2016 20:31:25 +0100 Subject: Set a spinner for sign in --- src/client/elm/View/Icon.elm | 7 +++++++ src/client/elm/View/SignIn.elm | 26 ++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/client/elm/View') 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 "" -- cgit v1.2.3