Skip to content

Commit 914911f

Browse files
committed
finish everything
1 parent ce13397 commit 914911f

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/Main.elm

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ update msg model =
4949
( { model | selectedFilm = Just 1 }, (Request.Gifs.getGifs thisFilm) )
5050

5151
Hover int ->
52-
( { model | hoveredFilm = Just int }, Cmd.none )
52+
( { model | hoveredFilm = Just int, gifUrls = [] }, Cmd.none )
5353

5454
Unhover ->
5555
( { model | hoveredFilm = Nothing }, Cmd.none )

src/Request/Gifs.elm

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ getGifs : String -> Cmd Msg
1010
getGifs filmName =
1111
let
1212
url =
13-
"https://api.giphy.com/v1/gifs/search?api_key=Pwh6oykW1llZjlVW5hOcjNrytlOiFJDI&q=" ++ toString filmName ++ "&limit=8&offset=0&rating=R&lang=en"
13+
"https://api.giphy.com/v1/gifs/search?api_key=Pwh6oykW1llZjlVW5hOcjNrytlOiFJDI&q=" ++ toString filmName ++ "&limit=4&offset=0&rating=R&lang=en"
1414

1515
request =
1616
Http.get url gifsDecoder

src/Views/View.elm

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ view model =
1414
, p [ class "white f2 ml4 mb1" ] [ text "Studio Ghibli films" ]
1515
, div [ class "flex" ]
1616
[ createFilmListSection model
17-
, filmDescription model
17+
, div
18+
[ class "w-60" ]
19+
[ buildGifs model.gifUrls
20+
, filmDescription model
21+
]
1822
]
19-
, buildGifs model.gifUrls
2023
]
2124

2225

@@ -49,24 +52,24 @@ buttonStyle =
4952

5053
gifStyle : Attribute msg
5154
gifStyle =
52-
class "grow ma2 br2 h4 flex align-center"
55+
class "grow br2 h4 flex align-center"
5356

5457

5558
createGif : ( GifLink, GifSrc ) -> Html Msg
5659
createGif ( gifLink, gifSrc ) =
57-
a [ href gifLink ] [ img [ src gifSrc, alt "a gif", gifStyle ] [] ]
60+
a [ class "mr2 ml0", href gifLink ] [ img [ src gifSrc, alt "a gif", gifStyle ] [] ]
5861

5962

6063
buildGifs : List ( GifLink, GifSrc ) -> Html Msg
6164
buildGifs gifUrls =
62-
section [ class "bg-pink pa2" ] <| List.map createGif gifUrls
65+
section [ class "bg-pink flex" ] <| List.map createGif gifUrls
6366

6467

6568
filmDescription : Model -> Html Msg
6669
filmDescription model =
6770
case model.hoveredFilm of
6871
Nothing ->
69-
h2 [ class "flex white w-60 helvetica i fw2 lh-copy mr5" ] [ text "Hover over a film title to see the description! Click for gifs!" ]
72+
h2 [ class "white helvetica i fw2 lh-copy mr5" ] [ text "Hover over a film title to see the description! Click for gifs!" ]
7073

7174
Just int ->
7275
let
@@ -78,4 +81,4 @@ filmDescription model =
7881
Just film ->
7982
film.description
8083
in
81-
h2 [ class "flex white w-60 helvetica i fw2 lh-copy mr5" ] [ text description ]
84+
h2 [ class "white helvetica i fw2 lh-copy mr5" ] [ text description ]

0 commit comments

Comments
 (0)