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 exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
@@ -14,17 +14,13 @@ model =
view model = view model =
div div [ class "content" ]
[ class "content" ] [ header []
[ header
[]
[ -- TODO add the equivalent of <h1>ElmHub</h1> right before the tagline [ -- TODO add the equivalent of <h1>ElmHub</h1> right before the tagline
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" ] [ li []
[ li
[]
[ span [ class "star-count" ] [{- TODO display the number of stars -}] [ span [ class "star-count" ] [{- TODO display the number of stars -}]
-- TODO use the model to put a link here that points to -- TODO use the model to put a link here that points to
-- https://github.com/TheSeamau5/elm-checkerboardgrid-tutorial -- https://github.com/TheSeamau5/elm-checkerboardgrid-tutorial

View File

@@ -8,8 +8,8 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"evancz/elm-html": "4.0.0 <= 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 exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
@@ -53,15 +53,12 @@ model =
{-| TODO add a type annotation to this function {-| TODO add a type annotation to this function
-} -}
view model = view model =
div div [ class "content" ]
[ class "content" ] [ header []
[ header
[]
[ h1 [] [ text "ElmHub" ] [ 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" ]
[{- TODO use model.results and viewSearchResults to display results -}] [{- TODO use model.results and viewSearchResults to display results -}]
] ]
@@ -69,11 +66,9 @@ view model =
{-| TODO add a type annotation to this function {-| TODO add a type annotation to this function
-} -}
viewSearchResult result = viewSearchResult result =
li li []
[]
[ span [ class "star-count" ] [ text (toString result.stars) ] [ span [ class "star-count" ] [ text (toString result.stars) ]
, a , a [ href ("https://github.com/" ++ result.name), target "_blank" ]
[ href ("https://github.com/" ++ result.name), target "_blank" ]
[ text result.name ] [ text result.name ]
] ]

View File

@@ -8,8 +8,8 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"evancz/elm-html": "4.0.0 <= 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 exposing (..)
import Html.App
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Auth
import StartApp.Simple as StartApp
import Signal exposing (Address)
type alias Model = type alias Model =
@@ -53,28 +50,23 @@ initialModel =
} }
view : Address Action -> Model -> Html view : Model -> Html Msg
view address model = view model =
div div [ class "content" ]
[ class "content" ] [ header []
[ header
[]
[ h1 [] [ text "ElmHub" ] [ 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" ] (List.map viewSearchResult model.results)
(List.map (viewSearchResult address) model.results)
] ]
viewSearchResult : Address Action -> SearchResult -> Html viewSearchResult : SearchResult -> Html Msg
viewSearchResult address result = viewSearchResult result =
li li []
[]
[ span [ class "star-count" ] [ text (toString result.stars) ] [ span [ class "star-count" ] [ text (toString result.stars) ]
, a , a [ href ("https://github.com/" ++ result.name), target "_blank" ]
[ href ("https://github.com/" ++ result.name), 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
@@ -83,20 +75,21 @@ viewSearchResult address result =
] ]
type alias Action = type alias Msg =
{ -- TODO implement this type alias { -- TODO implement this type alias
} }
update : Action -> Model -> Model update : Msg -> Model -> Model
update action model = update msg model =
-- TODO if we receive a DELETE_BY_ID action, -- TODO if we receive a DELETE_BY_ID message,
-- build a new model without the given ID present anymore. -- build a new model without the given ID present anymore.
model model
main : Program Never
main = main =
StartApp.start Html.App.beginnerProgram
{ view = view { view = view
, update = update , update = update
, model = initialModel , model = initialModel

View File

@@ -8,10 +8,8 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"evancz/elm-effects": "2.0.0 <= v < 3.0.0", "elm-lang/html": "1.0.0 <= v < 2.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.17.0 <= v < 0.18.0"
} }