Skip to content

Commit 0ba117b

Browse files
committed
#15 Description appears on hover
1 parent 4f10a65 commit 0ba117b

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

elm-package.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"exposed-modules": [],
1010
"dependencies": {
1111
"NoRedInk/elm-decode-pipeline": "3.0.0 <= v < 4.0.0",
12+
"elm-community/list-extra": "6.1.0 <= v < 7.0.0",
1213
"elm-lang/core": "5.1.1 <= v < 6.0.0",
1314
"elm-lang/html": "2.0.0 <= v < 3.0.0",
1415
"elm-lang/http": "1.0.0 <= v < 2.0.0"

src/Views/View.elm

+15-14
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import Types exposing (..)
44
import Html exposing (..)
55
import Html.Attributes exposing (..)
66
import Html.Events exposing (onInput, onClick, onMouseEnter)
7+
import List.Extra exposing (getAt)
78

89

910
view : Model -> Html Msg
1011
view model =
1112
div [ class "mh5" ]
12-
[ h1 [ class "tc f1 hot-pink ma5 b" ] [ text "Studio Ghibli Horseplay" ]
13+
[ h1 [ class "tc f1 orange ma5 b" ] [ text "Studio Ghibli Horseplay" ]
1314
, createFilmListSection model
1415
, buildGifs model.gifUrls
15-
, filmDescriptionTitleFunction model
16+
, filmDescription model
1617
]
1718

1819

@@ -34,15 +35,6 @@ buttonStyle =
3435
class "pointer grow bg-blue h-10 ba b--black br2 ma2"
3536

3637

37-
38-
-- Note, need to turn into createFilmButton
39-
-- createCharacterButton : Character -> String -> Html Msg
40-
-- createCharacterButton characterName characterUrl =
41-
-- -- button [ onClick (SelectCharacter characterName), buttonStyle ]
42-
-- [ img [ src characterUrl, alt <| toString characterName ] []
43-
-- ]
44-
45-
4638
gifStyle : Attribute msg
4739
gifStyle =
4840
class "grow ma2 br2 h4 flex align-center"
@@ -58,11 +50,20 @@ buildGifs gifUrls =
5850
section [ class "bg-pink pa2" ] <| List.map createGif gifUrls
5951

6052

61-
filmDescriptionTitleFunction : Model -> Html Msg
62-
filmDescriptionTitleFunction model =
53+
filmDescription : Model -> Html Msg
54+
filmDescription model =
6355
case model.hoveredFilm of
6456
Nothing ->
6557
h2 [] [ text "Choose a film, goddamnit" ]
6658

6759
Just int ->
68-
h2 [] [ text "wow you choose a film" ]
60+
let
61+
description =
62+
case getAt int model.allFilms of
63+
Nothing ->
64+
"you broke it"
65+
66+
Just film ->
67+
film.description
68+
in
69+
h2 [] [ text description ]

0 commit comments

Comments
 (0)