diff --git a/stages/10/Component/SearchResult.elm b/stages/10/Component/SearchResult.elm index 67d7d37..4dedbd3 100644 --- a/stages/10/Component/SearchResult.elm +++ b/stages/10/Component/SearchResult.elm @@ -26,12 +26,8 @@ type Action update : Action -> Model -> ( Model, Effects Action ) update action model = - case action of - Expand -> - ( { model | expanded = True }, Effects.none ) - - Collapse -> - ( { model | expanded = False }, Effects.none ) + -- TODO make expand and collapse work + ( model, Effects.none ) view : Address Action -> Model -> Html @@ -44,11 +40,13 @@ view address model = [ href ("https://github.com/" ++ model.name), target "_blank" ] [ text model.name ] , button - [ class "hide-result", onClick address Collapse ] + -- TODO when the user clicks, send a Collapse action + [ class "hide-result" ] [ text "X" ] ] else [ button - [ class "expand-result", onClick address Expand ] + -- TODO when the user clicks, send an Expand action + [ class "expand-result" ] [ text "Show" ] ] diff --git a/stages/10/README.md b/stages/10/README.md index 5bbcd78..8f7f700 100644 --- a/stages/10/README.md +++ b/stages/10/README.md @@ -16,8 +16,10 @@ to fail; in that case, just run `elm package install` again.) elm live Main.elm --open -- --output=elm.js ``` -## Compiling CSS +## Running Tests ```bash -elm test css/Stylesheets.elm +cd test +elm package install +elm test TestRunner.elm ``` diff --git a/stages/10/elm-package.json b/stages/10/elm-package.json index ea197b6..5728b71 100644 --- a/stages/10/elm-package.json +++ b/stages/10/elm-package.json @@ -12,8 +12,7 @@ "evancz/elm-effects": "2.0.0 <= v < 3.0.0", "evancz/elm-html": "4.0.0 <= v < 5.0.0", "evancz/elm-http": "3.0.0 <= v < 4.0.0", - "evancz/start-app": "2.0.0 <= v < 3.0.0", - "rtfeldman/elm-css": "1.0.0 <= v < 2.0.0" + "evancz/start-app": "2.0.0 <= v < 3.0.0" }, "elm-version": "0.16.0 <= v < 0.17.0" } diff --git a/stages/9/Component/ElmHub.elm b/stages/11/Component/ElmHub.elm similarity index 100% rename from stages/9/Component/ElmHub.elm rename to stages/11/Component/ElmHub.elm diff --git a/stages/9/Component/SearchResult.elm b/stages/11/Component/SearchResult.elm similarity index 75% rename from stages/9/Component/SearchResult.elm rename to stages/11/Component/SearchResult.elm index 4dedbd3..67d7d37 100644 --- a/stages/9/Component/SearchResult.elm +++ b/stages/11/Component/SearchResult.elm @@ -26,8 +26,12 @@ type Action update : Action -> Model -> ( Model, Effects Action ) update action model = - -- TODO make expand and collapse work - ( model, Effects.none ) + case action of + Expand -> + ( { model | expanded = True }, Effects.none ) + + Collapse -> + ( { model | expanded = False }, Effects.none ) view : Address Action -> Model -> Html @@ -40,13 +44,11 @@ view address model = [ href ("https://github.com/" ++ model.name), target "_blank" ] [ text model.name ] , button - -- TODO when the user clicks, send a Collapse action - [ class "hide-result" ] + [ class "hide-result", onClick address Collapse ] [ text "X" ] ] else [ button - -- TODO when the user clicks, send an Expand action - [ class "expand-result" ] + [ class "expand-result", onClick address Expand ] [ text "Show" ] ] diff --git a/stages/10/ElmHub.elm b/stages/11/ElmHub.elm similarity index 100% rename from stages/10/ElmHub.elm rename to stages/11/ElmHub.elm diff --git a/stages/11/Main.elm b/stages/11/Main.elm new file mode 100644 index 0000000..5b8e88e --- /dev/null +++ b/stages/11/Main.elm @@ -0,0 +1,27 @@ +module Main (..) where + +import StartApp +import Component.ElmHub exposing (..) +import Effects exposing (Effects) +import Task exposing (Task) +import Html exposing (Html) + + +main : Signal Html +main = + app.html + + +app : StartApp.App Model +app = + StartApp.start + { view = view + , update = update + , init = ( initialModel, Effects.task (searchFeed initialModel.query) ) + , inputs = [] + } + + +port tasks : Signal (Task Effects.Never ()) +port tasks = + app.tasks diff --git a/stages/11/README.md b/stages/11/README.md new file mode 100644 index 0000000..b46a7a8 --- /dev/null +++ b/stages/11/README.md @@ -0,0 +1,23 @@ +Stage 11 +======== + +## Installation + +```bash +elm package install +``` + +(Answer `y` at the prompt. In rare cases a known issue can cause the download +to fail; in that case, just run `elm package install` again.) + +## Building + +```bash +elm live Main.elm --open -- --output=elm.js +``` + +## Compiling CSS + +```bash +elm test css/Stylesheets.elm +``` diff --git a/stages/10/Stylesheets.elm b/stages/11/Stylesheets.elm similarity index 100% rename from stages/10/Stylesheets.elm rename to stages/11/Stylesheets.elm diff --git a/stages/10/css/Stylesheets.elm b/stages/11/css/Stylesheets.elm similarity index 100% rename from stages/10/css/Stylesheets.elm rename to stages/11/css/Stylesheets.elm diff --git a/stages/11/elm-hub.png b/stages/11/elm-hub.png new file mode 100644 index 0000000..ba32816 Binary files /dev/null and b/stages/11/elm-hub.png differ diff --git a/stages/11/elm-package.json b/stages/11/elm-package.json new file mode 100644 index 0000000..ea197b6 --- /dev/null +++ b/stages/11/elm-package.json @@ -0,0 +1,19 @@ +{ + "version": "1.0.0", + "summary": "Like GitHub, but for Elm stuff.", + "repository": "https://github.com/rtfeldman/elm-workshop.git", + "license": "BSD-3-Clause", + "source-directories": [ + "." + ], + "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/elm-http": "3.0.0 <= v < 4.0.0", + "evancz/start-app": "2.0.0 <= v < 3.0.0", + "rtfeldman/elm-css": "1.0.0 <= v < 2.0.0" + }, + "elm-version": "0.16.0 <= v < 0.17.0" +} diff --git a/stages/11/index.html b/stages/11/index.html new file mode 100644 index 0000000..5db9b93 --- /dev/null +++ b/stages/11/index.html @@ -0,0 +1,26 @@ + + + +
+ +