From dffa33f776d18182e9f04d84d1f098fb34128945 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 26 Mar 2016 07:46:08 -0700 Subject: [PATCH] Update 1 --- stages/1/Main.elm | 35 ++++++++++------------------------- stages/1/elm-package.json | 4 +--- stages/2/Main.elm | 4 +--- 3 files changed, 12 insertions(+), 31 deletions(-) diff --git a/stages/1/Main.elm b/stages/1/Main.elm index dbeb859..6a605f8 100644 --- a/stages/1/Main.elm +++ b/stages/1/Main.elm @@ -2,16 +2,10 @@ module Main (..) where import Html exposing (..) import Html.Attributes exposing (..) -import StartApp.Simple as StartApp -import Signal exposing (Address) main = - StartApp.start - { view = view - , update = update - , model = initialModel - } + view model type alias Model = @@ -35,8 +29,8 @@ type alias ResultId = {- See https://developer.github.com/v3/search/#example -} -initialModel : Model -initialModel = +model : Model +model = { query = "tutorial" , results = [ { id = 1 @@ -63,14 +57,14 @@ initialModel = } -view : Address Action -> Model -> Html -view address model = +view : Model -> Html +view model = div [ class "content" ] [ header [] - [ -- TODO add the equivalent of

ElmHub

right before the tagline - span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ] + [ h1 [] [ text "ElmHub" ] + , span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ] ] , ul [ class "results" ] @@ -83,17 +77,8 @@ viewSearchResult result = li [] [ span [ class "star-count" ] [ text (toString result.stars) ] - -- TODO replace the following with a link to the appropriate GitHub repo. + , a + [ href ("https://github.com/" ++ result.name), target "_blank" ] + [ text result.name ] , text result.name ] - - -type alias Action = - { actionType : String - , payload : Int - } - - -update : Action -> Model -> Model -update action model = - model diff --git a/stages/1/elm-package.json b/stages/1/elm-package.json index 588e1cf..2b33bdf 100644 --- a/stages/1/elm-package.json +++ b/stages/1/elm-package.json @@ -9,9 +9,7 @@ "exposed-modules": [], "dependencies": { "elm-lang/core": "3.0.0 <= v < 4.0.0", - "evancz/elm-effects": "2.0.0 <= v < 3.0.0", - "evancz/elm-html": "4.0.0 <= v < 5.0.0", - "evancz/start-app": "2.0.0 <= v < 3.0.0" + "evancz/elm-html": "4.0.0 <= v < 5.0.0" }, "elm-version": "0.16.0 <= v < 0.17.0" } diff --git a/stages/2/Main.elm b/stages/2/Main.elm index 1f50adf..c30d61a 100644 --- a/stages/2/Main.elm +++ b/stages/2/Main.elm @@ -85,9 +85,7 @@ viewSearchResult address result = [] [ span [ class "star-count" ] [ text (toString result.stars) ] , a - [ href ("https://github.com/" ++ result.name) - , target "_blank" - ] + [ href ("https://github.com/" ++ result.name), target "_blank" ] [ text result.name ] , button -- TODO add an onClick handler that sends a DELETE_BY_ID action