Shift everything forward a partg
This commit is contained in:
@@ -1,35 +1,15 @@
|
||||
module Main exposing (..)
|
||||
|
||||
import Html exposing (..)
|
||||
import Html.App as Html
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
|
||||
|
||||
initialModel =
|
||||
{ query = "tutorial"
|
||||
, results =
|
||||
[ { id = 1
|
||||
, name = "TheSeamau5/elm-checkerboardgrid-tutorial"
|
||||
, stars = 66
|
||||
}
|
||||
, { id = 2
|
||||
, name = "grzegorzbalcerek/elm-by-example"
|
||||
, stars = 41
|
||||
}
|
||||
, { id = 3
|
||||
, name = "sporto/elm-tutorial-app"
|
||||
, stars = 35
|
||||
}
|
||||
, { id = 4
|
||||
, name = "jvoigtlaender/Elm-Tutorium"
|
||||
, stars = 10
|
||||
}
|
||||
, { id = 5
|
||||
, name = "sporto/elm-tutorial-assets"
|
||||
, stars = 7
|
||||
}
|
||||
]
|
||||
model =
|
||||
{ result =
|
||||
{ id = 1
|
||||
, name = "TheSeamau5/elm-checkerboardgrid-tutorial"
|
||||
, stars = 66
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,31 +23,16 @@ elmHubHeader =
|
||||
view model =
|
||||
div [ class "content" ]
|
||||
[ elmHubHeader
|
||||
, ul [ class "results" ] (List.map viewSearchResult model.results)
|
||||
, 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
|
||||
-- by prepending the "https://github.com/" part.
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
viewSearchResult result =
|
||||
li []
|
||||
[ span [ class "star-count" ] [ text (toString result.stars) ]
|
||||
, a [ href ("https://github.com/" ++ result.name), target "_blank" ]
|
||||
[ text result.name ]
|
||||
, button
|
||||
-- TODO add an onClick handler that sends a DELETE_BY_ID msg
|
||||
[ class "hide-result" ]
|
||||
[ text "X" ]
|
||||
]
|
||||
|
||||
|
||||
update msg model =
|
||||
-- TODO if msg.operation == "DELETE_BY_ID",
|
||||
-- then return a new model without the given ID present anymore.
|
||||
model
|
||||
|
||||
|
||||
main =
|
||||
Html.beginnerProgram
|
||||
{ view = view
|
||||
, update = update
|
||||
, model = initialModel
|
||||
}
|
||||
view model
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Part 2
|
||||
Part 1
|
||||
======
|
||||
|
||||
The instructor will paste notes from the lesson, including code examples from
|
||||
@@ -20,7 +20,6 @@ elm-live Main.elm --open --output=elm.js
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
* [Type Annotation syntax reference](http://elm-lang.org/docs/syntax#type-annotations)
|
||||
* [`type alias` syntax reference](http://elm-lang.org/docs/syntax#type-aliases)
|
||||
* [`List.map` documentation](http://package.elm-lang.org/packages/elm-lang/core/3.0.0/List#map)
|
||||
* [html-to-elm](http://mbylstra.github.io/html-to-elm/) - paste in HTML, get elm-html code
|
||||
* [elm-html documentation](http://package.elm-lang.org/packages/elm-lang/html/latest)
|
||||
* [record syntax](http://elm-lang.org/docs/syntax#records) (e.g. `{ foo = 1, bar = 2 }`)
|
||||
|
||||
Reference in New Issue
Block a user