Update 1
This commit is contained in:
@@ -2,16 +2,10 @@ module Main (..) where
|
|||||||
|
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import StartApp.Simple as StartApp
|
|
||||||
import Signal exposing (Address)
|
|
||||||
|
|
||||||
|
|
||||||
main =
|
main =
|
||||||
StartApp.start
|
view model
|
||||||
{ view = view
|
|
||||||
, update = update
|
|
||||||
, model = initialModel
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
type alias Model =
|
type alias Model =
|
||||||
@@ -35,8 +29,8 @@ type alias ResultId =
|
|||||||
{- See https://developer.github.com/v3/search/#example -}
|
{- See https://developer.github.com/v3/search/#example -}
|
||||||
|
|
||||||
|
|
||||||
initialModel : Model
|
model : Model
|
||||||
initialModel =
|
model =
|
||||||
{ query = "tutorial"
|
{ query = "tutorial"
|
||||||
, results =
|
, results =
|
||||||
[ { id = 1
|
[ { id = 1
|
||||||
@@ -63,14 +57,14 @@ initialModel =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
view : Address Action -> Model -> Html
|
view : Model -> Html
|
||||||
view address model =
|
view model =
|
||||||
div
|
div
|
||||||
[ class "content" ]
|
[ class "content" ]
|
||||||
[ header
|
[ header
|
||||||
[]
|
[]
|
||||||
[ -- TODO add the equivalent of <h1>ElmHub</h1> right before the tagline
|
[ h1 [] [ text "ElmHub" ]
|
||||||
span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
|
, span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
|
||||||
]
|
]
|
||||||
, ul
|
, ul
|
||||||
[ class "results" ]
|
[ class "results" ]
|
||||||
@@ -83,17 +77,8 @@ viewSearchResult result =
|
|||||||
li
|
li
|
||||||
[]
|
[]
|
||||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
[ 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
|
, text result.name
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
type alias Action =
|
|
||||||
{ actionType : String
|
|
||||||
, payload : Int
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
update : Action -> Model -> Model
|
|
||||||
update action model =
|
|
||||||
model
|
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
"exposed-modules": [],
|
"exposed-modules": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"elm-lang/core": "3.0.0 <= v < 4.0.0",
|
"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/elm-html": "4.0.0 <= v < 5.0.0",
|
|
||||||
"evancz/start-app": "2.0.0 <= v < 3.0.0"
|
|
||||||
},
|
},
|
||||||
"elm-version": "0.16.0 <= v < 0.17.0"
|
"elm-version": "0.16.0 <= v < 0.17.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,9 +85,7 @@ viewSearchResult address result =
|
|||||||
[]
|
[]
|
||||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
||||||
, a
|
, a
|
||||||
[ href ("https://github.com/" ++ result.name)
|
[ href ("https://github.com/" ++ result.name), target "_blank" ]
|
||||||
, target "_blank"
|
|
||||||
]
|
|
||||||
[ text result.name ]
|
[ text result.name ]
|
||||||
, button
|
, button
|
||||||
-- TODO add an onClick handler that sends a DELETE_BY_ID action
|
-- TODO add an onClick handler that sends a DELETE_BY_ID action
|
||||||
|
|||||||
Reference in New Issue
Block a user