aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-11-22 17:06:42 +0000
committerAkshay <[email protected]>2020-11-22 17:06:42 +0000
commit86bd94ec91e88f3a50a02daf051fcca316db09a5 (patch)
tree16e8bc17ffaf27b3938991b8a4b825dbfd6ad6c5
parentdea97903678804c9b82039dddf7b3c461dfa514e (diff)
begin work on layouting and global styling
-rw-r--r--src/Data.elm2
-rw-r--r--src/Main.elm23
-rw-r--r--src/Styles.elm9
-rw-r--r--src/Views.elm13
4 files changed, 35 insertions, 12 deletions
diff --git a/src/Data.elm b/src/Data.elm
index 95c92c1..244f149 100644
--- a/src/Data.elm
+++ b/src/Data.elm
@@ -23,7 +23,7 @@ punctuations =
23 23
24falseWeightedBool : Random.Generator Bool 24falseWeightedBool : Random.Generator Bool
25falseWeightedBool = 25falseWeightedBool =
26 Random.weighted ( 20, True ) [ ( 80, False ) ] 26 Random.weighted ( 5, True ) [ ( 95, False ) ]
27 27
28 28
29randomWord : Config -> Random.Generator ( Int, Bool, Bool ) 29randomWord : Config -> Random.Generator ( Int, Bool, Bool )
diff --git a/src/Main.elm b/src/Main.elm
index 620ef7c..4ca4934 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -4,7 +4,7 @@ import Array exposing (..)
4import Base exposing (..) 4import Base exposing (..)
5import Browser 5import Browser
6import Css 6import Css
7import Css.Global exposing (global, selector) 7import Css.Global exposing (everything, global, selector)
8import Data exposing (..) 8import Data exposing (..)
9import Html 9import Html
10import Html.Styled exposing (..) 10import Html.Styled exposing (..)
@@ -217,15 +217,20 @@ currentContents model =
217 217
218view : Model -> Html Msg 218view : Model -> Html Msg
219view model = 219view model =
220 pre [] 220 div []
221 [ p [] [ text ("POS: " ++ viewProgress model) ] 221 [ div []
222 , p [] [ text ("WPM: " ++ viewWpm model) ] 222 [ viewWordLengthOptions
223 , p [] [ text ("ACC: " ++ viewAccuracy model.words) ] 223 , viewStats model
224 , viewWordLengthOptions 224 ]
225 , toPara model.words model.currentWord (currentContents model) 225 , div []
226 , styledInput [ onInput handleInputChanged, value model.inputBox ] [] 226 [ toPara model.words model.currentWord (currentContents model)
227 , styledButton [ onClick Redo ] [ text "redo" ] 227 , div []
228 [ styledInput [ onInput handleInputChanged, value model.inputBox ] []
229 , styledButton [ onClick Redo ] [ text "redo" ]
230 ]
231 ]
228 , global [ selector "li:not(:last-child)::after" [ Css.property "content" "' / '" ] ] 232 , global [ selector "li:not(:last-child)::after" [ Css.property "content" "' / '" ] ]
233 , global [ everything [ Css.fontFamily Css.monospace ] ]
229 ] 234 ]
230 235
231 236
diff --git a/src/Styles.elm b/src/Styles.elm
index 57c124b..36bd1a3 100644
--- a/src/Styles.elm
+++ b/src/Styles.elm
@@ -65,3 +65,12 @@ styledTextBox =
65 , width (px 500) 65 , width (px 500)
66 , display inlineBlock 66 , display inlineBlock
67 ] 67 ]
68
69
70actionContainer : List (Attribute msg) -> List (Html msg) -> Html msg
71actionContainer =
72 styled
73 div
74 [ padding (px 12)
75 , width (pct 100)
76 ]
diff --git a/src/Views.elm b/src/Views.elm
index 5e2dbcb..b56a945 100644
--- a/src/Views.elm
+++ b/src/Views.elm
@@ -1,4 +1,4 @@
1module Views exposing (viewAccuracy, viewProgress, viewWordLengthOptions, viewWpm) 1module Views exposing (..)
2 2
3import Array exposing (..) 3import Array exposing (..)
4import Base exposing (..) 4import Base exposing (..)
@@ -56,7 +56,7 @@ viewProgress model =
56 total = 56 total =
57 model.config.length 57 model.config.length
58 in 58 in
59 String.fromInt soFar ++ "/" ++ String.fromInt total 59 String.fromInt soFar ++ ":" ++ String.fromInt total
60 60
61 61
62viewAccuracy : Array Word -> String 62viewAccuracy : Array Word -> String
@@ -98,3 +98,12 @@ viewWordLengthOptions =
98 ) 98 )
99 wl 99 wl
100 ) 100 )
101
102
103viewStats : Model -> Html Msg
104viewStats model =
105 styledUnorderedList []
106 [ styledListItem [] [ text ("WPM " ++ viewWpm model) ]
107 , styledListItem [] [ text ("ACC " ++ viewAccuracy model.words) ]
108 , styledListItem [] [ text ("POS " ++ viewProgress model) ]
109 ]