aboutsummaryrefslogtreecommitdiff
path: root/src/Styles.elm
blob: 7b2eea705a7cb315cdef9c05f2cebeb745411eb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{-
   - This file is part of `typers`.
   -
   - `typers` is free software: you can redistribute it and/or modify
   - it under the terms of the GNU Affero Public License as published by
   - the Free Software Foundation, either version 3 of the License, or
   - (at your option) any later version.
   -
   - `typers` is distributed in the hope that it will be useful,
   - but WITHOUT ANY WARRANTY; without even the implied warranty of
   - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   - GNU Affero Public License for more details.
   -
   - You should have received a copy of the GNU Affero Public License
   - along with `typers`.  If not, see <https://www.gnu.org/licenses/>.
-}


module Styles exposing (..)

import Base exposing (WordStatus(..))
import Css exposing (..)
import Css.Global exposing (global, selector)
import Html
import Html.Styled exposing (..)


styledButton : List (Attribute msg) -> List (Html msg) -> Html msg
styledButton =
    styled
        button
        [ marginTop (px 12)
        , marginBottom (px 12)
        , paddingTop (px 12)
        , paddingBottom (px 12)
        , paddingLeft (px 0)
        , paddingRight (px 0)
        , fontFamily monospace
        , border (px 0)
        , backgroundColor (hex "#fff")
        , borderRadius (px 4)
        ]


correctInputStyle : Style
correctInputStyle =
    color (hex "#000")


wrongInputStyle : Style
wrongInputStyle =
    wrongWordStyle


styledInput : Bool -> List (Attribute msg) -> List (Html msg) -> Html msg
styledInput inputStatus =
    styled
        input
        [ fontFamily monospace
        , if inputStatus then
            correctInputStyle

          else
            wrongInputStyle
        , border zero
        , paddingTop (px 12)
        , paddingBottom (px 12)
        , width (pct 95)
        ]


styledListItem : List (Attribute msg) -> List (Html msg) -> Html msg
styledListItem =
    styled
        li
        [ display inline
        ]


styledUnorderedList : List (Attribute msg) -> List (Html msg) -> Html msg
styledUnorderedList =
    styled
        ul
        [ listStyle Css.none
        , padding (px 0)
        ]


styledExternalLink : List (Attribute msg) -> List (Html msg) -> Html msg
styledExternalLink =
    styled
        a
        [ textDecoration underline
        , color (hex "#666")
        ]


styledTextBox : List (Attribute msg) -> List (Html msg) -> Html msg
styledTextBox =
    styled
        div
        [ color (hex "#000")
        , fontFamily monospace
        , border (px 0)
        , borderRadius (px 4)
        , paddingTop (px 12)
        , paddingBottom (px 12)
        , display inlineBlock
        ]


actionContainer : List (Attribute msg) -> List (Html msg) -> Html msg
actionContainer =
    styled
        div
        [ padding (px 12)
        , width (pct 100)
        ]


wrongWordStyle : Style
wrongWordStyle =
    color (hex "#f07178")


correctWordStyle : Style
correctWordStyle =
    color (hex "#13CA91")


todoWordStyle : Style
todoWordStyle =
    color (hex "#787878")


currentWordStyle : Style
currentWordStyle =
    textDecoration underline


wordStyle : WordStatus -> Style
wordStyle w =
    case w of
        Correct ->
            correctWordStyle

        Wrong ->
            wrongWordStyle

        Todo ->
            todoWordStyle

        CurrentWord ->
            currentWordStyle