From dea97903678804c9b82039dddf7b3c461dfa514e Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 22 Nov 2020 22:08:14 +0530 Subject: begin work on basic styling --- src/Views.elm | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/Views.elm') diff --git a/src/Views.elm b/src/Views.elm index c5cc159..5e2dbcb 100644 --- a/src/Views.elm +++ b/src/Views.elm @@ -1,7 +1,12 @@ -module Views exposing (viewAccuracy, viewProgress, viewWpm) +module Views exposing (viewAccuracy, viewProgress, viewWordLengthOptions, viewWpm) import Array exposing (..) import Base exposing (..) +import Css exposing (..) +import Html +import Html.Styled exposing (..) +import Html.Styled.Events exposing (onClick) +import Styles exposing (styledListItem, styledUnorderedList) import Time exposing (Posix, toHour, toMinute, toSecond, utc) import Utils exposing (diffDuration, wordCountWith) @@ -42,8 +47,15 @@ viewWpm model = Maybe.withDefault "XX" wpm -viewProgress : Int -> Int -> String -viewProgress soFar total = +viewProgress : Model -> String +viewProgress model = + let + soFar = + model.currentWord + 1 + + total = + model.config.length + in String.fromInt soFar ++ "/" ++ String.fromInt total @@ -69,3 +81,20 @@ viewAccuracy words = Just a -> String.fromInt <| truncate a + + +viewWordLengthOptions : Html Msg +viewWordLengthOptions = + let + wl = + [ 10, 25, 50, 100 ] + in + styledUnorderedList [] + (List.map + (\len -> + styledListItem + [ onClick (Base.WordLengthChanged len) ] + [ text <| String.fromInt len ] + ) + wl + ) -- cgit v1.2.3