aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJasper Van der Jeugt2020-07-31 21:47:54 +0200
committerJasper Van der Jeugt2020-07-31 21:47:54 +0200
commit703bad4fad198d670272fd71d84912ba4dfda264 (patch)
tree721e192497b06a284d66e08380ac3db3751c9ab8 /client
parent08e9b8a5a17b0b5df16322298e6cfb35ed7bd6c6 (diff)
Capitalization
Diffstat (limited to 'client')
-rw-r--r--client/src/Client.elm22
1 files changed, 15 insertions, 7 deletions
diff --git a/client/src/Client.elm b/client/src/Client.elm
index aebeb8f..5170e64 100644
--- a/client/src/Client.elm
+++ b/client/src/Client.elm
@@ -132,16 +132,24 @@ blackCardContent cards (Messages.BlackCard idx) =
blackCardBlanks : Cards -> BlackCard -> Int
blackCardBlanks cards c = List.length (blackCardContent cards c) - 1
+capitalizeFirst : List String -> List String
+capitalizeFirst l = case l of
+ x :: xs -> (String.toUpper (String.left 1 x) ++ String.dropLeft 1 x) :: xs
+ _ -> l
+
blackCard : Cards -> BlackCard -> List WhiteCard -> Html a
blackCard cards black whites =
- let blank mbWhite = Html.span
- [Html.Attributes.class "blank"] <|
- case mbWhite of
- Nothing -> []
- Just w -> [Html.text <| whiteCardContent cards w] in
+ let blackParts = blackCardContent cards black
+ whiteParts = List.map (whiteCardContent cards) whites |>
+ case blackParts of
+ "" :: _ -> capitalizeFirst
+ _ -> identity
+ blank txt = Html.span
+ [Html.Attributes.class "blank"]
+ [Html.text txt] in
Html.div [Html.Attributes.class "card", Html.Attributes.class "black"] <|
- intersperseWith (List.map (\c -> blank (Just c)) whites) (blank Nothing) <|
- List.map Html.text <| blackCardContent cards black
+ intersperseWith (List.map blank whiteParts) (blank "") <|
+ List.map Html.text blackParts
whiteCardContent : Cards -> WhiteCard -> String
whiteCardContent cards (Messages.WhiteCard idx) =