diff --git a/part1/Main.elm b/part1/Main.elm
index 56a2cad..43afced 100644
--- a/part1/Main.elm
+++ b/part1/Main.elm
@@ -1,37 +1,33 @@
-module Main (..) where
+module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
model =
- { result =
- { id = 1
- , name = "TheSeamau5/elm-checkerboardgrid-tutorial"
- , stars = 66
- }
- }
+ { result =
+ { id = 1
+ , name = "TheSeamau5/elm-checkerboardgrid-tutorial"
+ , stars = 66
+ }
+ }
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.”" ]
- ]
- , 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
+ div [ class "content" ]
+ [ header []
+ [ -- TODO add the equivalent of ElmHub
right before the tagline
+ span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
+ ]
+ , 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
+ ]
]
]
- ]
main =
- view model
+ view model
diff --git a/part1/elm-package.json b/part1/elm-package.json
index 068fa12..3a09e24 100644
--- a/part1/elm-package.json
+++ b/part1/elm-package.json
@@ -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"
}
diff --git a/part2/Main.elm b/part2/Main.elm
index 8bad4aa..a7cbf53 100644
--- a/part2/Main.elm
+++ b/part2/Main.elm
@@ -1,84 +1,79 @@
-module Main (..) where
+module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
type alias Model =
- { query : String
- , results : List SearchResult
- }
+ { query : String
+ , results : List SearchResult
+ }
type alias SearchResult =
- { id : ResultId
- , name : String
- , stars : Int
- }
+ { id : ResultId
+ , name : String
+ , stars : Int
+ }
type alias ResultId =
- Int
+ Int
{-| TODO add a type annotation to this value
-}
model =
- { 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
- }
- ]
- }
+ { 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
+ }
+ ]
+ }
{-| TODO add a type annotation to this function
-}
view model =
- div
- [ class "content" ]
- [ header
- []
- [ h1 [] [ text "ElmHub" ]
- , span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
+ div [ class "content" ]
+ [ header []
+ [ h1 [] [ text "ElmHub" ]
+ , span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
+ ]
+ , ul [ class "results" ]
+ [{- TODO use model.results and viewSearchResults to display results -}]
]
- , ul
- [ class "results" ]
- [{- TODO use model.results and viewSearchResults to display results -}]
- ]
{-| TODO add a type annotation to this function
-}
viewSearchResult result =
- li
- []
- [ span [ class "star-count" ] [ text (toString result.stars) ]
- , a
- [ href ("https://github.com/" ++ result.name), target "_blank" ]
- [ text result.name ]
- ]
+ li []
+ [ span [ class "star-count" ] [ text (toString result.stars) ]
+ , a [ href ("https://github.com/" ++ result.name), target "_blank" ]
+ [ text result.name ]
+ ]
{-| TODO add a type annotation to this value
-}
main =
- view model
+ view model
diff --git a/part2/elm-package.json b/part2/elm-package.json
index 068fa12..3a09e24 100644
--- a/part2/elm-package.json
+++ b/part2/elm-package.json
@@ -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"
}
diff --git a/part3/Main.elm b/part3/Main.elm
index f69791a..494979d 100644
--- a/part3/Main.elm
+++ b/part3/Main.elm
@@ -1,103 +1,96 @@
-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 =
- { query : String
- , results : List SearchResult
- }
+ { query : String
+ , results : List SearchResult
+ }
type alias SearchResult =
- { id : ResultId
- , name : String
- , stars : Int
- }
+ { id : ResultId
+ , name : String
+ , stars : Int
+ }
type alias ResultId =
- Int
+ Int
initialModel : Model
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
- }
- ]
- }
-
-
-view : Address Action -> Model -> Html
-view address model =
- div
- [ class "content" ]
- [ header
- []
- [ h1 [] [ text "ElmHub" ]
- , span [ class "tagline" ] [ text "“Like GitHub, but for Elm things.”" ]
+ { 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
+ }
]
- , ul
- [ class "results" ]
- (List.map (viewSearchResult address) model.results)
- ]
-
-
-viewSearchResult : Address Action -> SearchResult -> Html
-viewSearchResult address 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 action
- [ class "hide-result" ]
- [ text "X" ]
- ]
-
-
-type alias Action =
- { -- TODO implement this type alias
- }
-
-
-update : Action -> Model -> Model
-update action model =
- -- TODO if we receive a DELETE_BY_ID action,
- -- build a new model without the given ID present anymore.
- model
-
-
-main =
- StartApp.start
- { view = view
- , update = update
- , model = initialModel
}
+
+
+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 model.results)
+ ]
+
+
+viewSearchResult : SearchResult -> Html Msg
+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 action
+ [ class "hide-result" ]
+ [ text "X" ]
+ ]
+
+
+type alias Msg =
+ { -- TODO implement this type alias
+ }
+
+
+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 =
+ Html.App.beginnerProgram
+ { view = view
+ , update = update
+ , model = initialModel
+ }
diff --git a/part3/elm-package.json b/part3/elm-package.json
index a500a2f..3a09e24 100644
--- a/part3/elm-package.json
+++ b/part3/elm-package.json
@@ -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"
}