Update part1, part2, and part3

This commit is contained in:
Richard Feldman
2016-06-19 23:11:49 -07:00
parent 6418f537e7
commit 557cb6d4ce
6 changed files with 152 additions and 170 deletions

View File

@@ -1,4 +1,4 @@
module Main (..) where
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
@@ -14,17 +14,13 @@ model =
view model =
div
[ class "content" ]
[ header
[]
div [ class "content" ]
[ header []
[ -- TODO add the equivalent of <h1>ElmHub</h1> right before the tagline
span [ class "tagline" ] [ text "Like GitHub, but for Elm things." ]
]
, ul
[ class "results" ]
[ li
[]
, ul [ class "results" ]
[ li []
[ span [ class "star-count" ] [{- TODO display the number of stars -}]
-- TODO use the model to put a link here that points to
-- https://github.com/TheSeamau5/elm-checkerboardgrid-tutorial

View File

@@ -8,8 +8,8 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-html": "4.0.0 <= v < 5.0.0"
"elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0"
},
"elm-version": "0.16.0 <= v < 0.17.0"
"elm-version": "0.17.0 <= v < 0.18.0"
}

View File

@@ -1,4 +1,4 @@
module Main (..) where
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
@@ -53,15 +53,12 @@ model =
{-| TODO add a type annotation to this function
-}
view model =
div
[ class "content" ]
[ header
[]
div [ class "content" ]
[ header []
[ h1 [] [ text "ElmHub" ]
, span [ class "tagline" ] [ text "Like GitHub, but for Elm things." ]
]
, ul
[ class "results" ]
, ul [ class "results" ]
[{- TODO use model.results and viewSearchResults to display results -}]
]
@@ -69,11 +66,9 @@ view model =
{-| TODO add a type annotation to this function
-}
viewSearchResult result =
li
[]
li []
[ span [ class "star-count" ] [ text (toString result.stars) ]
, a
[ href ("https://github.com/" ++ result.name), target "_blank" ]
, a [ href ("https://github.com/" ++ result.name), target "_blank" ]
[ text result.name ]
]

View File

@@ -8,8 +8,8 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-html": "4.0.0 <= v < 5.0.0"
"elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0"
},
"elm-version": "0.16.0 <= v < 0.17.0"
"elm-version": "0.17.0 <= v < 0.18.0"
}

View File

@@ -1,11 +1,8 @@
module Main (..) where
module Main exposing (..)
import Html exposing (..)
import Html.App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Auth
import StartApp.Simple as StartApp
import Signal exposing (Address)
type alias Model =
@@ -53,28 +50,23 @@ initialModel =
}
view : Address Action -> Model -> Html
view address model =
div
[ class "content" ]
[ header
[]
view : Model -> Html Msg
view model =
div [ class "content" ]
[ header []
[ h1 [] [ text "ElmHub" ]
, span [ class "tagline" ] [ text "Like GitHub, but for Elm things." ]
]
, ul
[ class "results" ]
(List.map (viewSearchResult address) model.results)
, ul [ class "results" ]
(List.map viewSearchResult model.results)
]
viewSearchResult : Address Action -> SearchResult -> Html
viewSearchResult address result =
li
[]
viewSearchResult : SearchResult -> Html Msg
viewSearchResult result =
li []
[ span [ class "star-count" ] [ text (toString result.stars) ]
, a
[ href ("https://github.com/" ++ result.name), target "_blank" ]
, a [ href ("https://github.com/" ++ result.name), target "_blank" ]
[ text result.name ]
, button
-- TODO add an onClick handler that sends a DELETE_BY_ID action
@@ -83,20 +75,21 @@ viewSearchResult address result =
]
type alias Action =
type alias Msg =
{ -- TODO implement this type alias
}
update : Action -> Model -> Model
update action model =
-- TODO if we receive a DELETE_BY_ID action,
update : Msg -> Model -> Model
update msg model =
-- TODO if we receive a DELETE_BY_ID message,
-- build a new model without the given ID present anymore.
model
main : Program Never
main =
StartApp.start
Html.App.beginnerProgram
{ view = view
, update = update
, model = initialModel

View File

@@ -8,10 +8,8 @@
],
"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"
"elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0"
},
"elm-version": "0.16.0 <= v < 0.17.0"
"elm-version": "0.17.0 <= v < 0.18.0"
}