diff --git a/stages/0/Main.elm b/stages/0/Main.elm new file mode 100644 index 0000000..4f34c41 --- /dev/null +++ b/stages/0/Main.elm @@ -0,0 +1,86 @@ +module Main (..) where + +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import StartApp.Simple as StartApp + + +main = + StartApp.start + { view = view + , update = update + , model = initialModel + } + + +type alias Model = + { query : String + , results : List SearchResult + } + + +type alias SearchResult = + { id : ResultId + , name : String + , stars : Int + } + + +type alias ResultId = + 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 model = + 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 -}] + ] + + +viewSearchResult result = + li + [] + [ span [ class "star-count" ] [ text (toString result.stars) ] + -- TODO replace the following span with a link that opens in a new window! + , text result.name + ] + + +update action model = + model diff --git a/stages/0/README.md b/stages/0/README.md new file mode 100644 index 0000000..e4a727c --- /dev/null +++ b/stages/0/README.md @@ -0,0 +1,17 @@ +Stage 1 +======= + +## 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 +``` diff --git a/stages/0/elm-hub.png b/stages/0/elm-hub.png new file mode 100644 index 0000000..ba32816 Binary files /dev/null and b/stages/0/elm-hub.png differ diff --git a/stages/0/elm-package.json b/stages/0/elm-package.json new file mode 100644 index 0000000..588e1cf --- /dev/null +++ b/stages/0/elm-package.json @@ -0,0 +1,17 @@ +{ + "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/start-app": "2.0.0 <= v < 3.0.0" + }, + "elm-version": "0.16.0 <= v < 0.17.0" +} diff --git a/stages/0/index.html b/stages/0/index.html new file mode 100644 index 0000000..d045ba4 --- /dev/null +++ b/stages/0/index.html @@ -0,0 +1,26 @@ + + + + + + ElmHub + + + + + + + + + + + + + + + diff --git a/stages/0/style.css b/stages/0/style.css new file mode 100644 index 0000000..5a5a285 --- /dev/null +++ b/stages/0/style.css @@ -0,0 +1,91 @@ + +.content { + width: 960px; + margin: 0 auto; + padding: 30px; + font-family: Helvetica, Arial, serif; +} + +header { + position: relative; + padding: 6px 12px; + background-color: rgb(96, 181, 204); +} + +h1 { + color: white; + font-weight: normal; + margin: 0; +} + +.tagline { + color: #eee; + position: absolute; + right: 16px; + top: 12px; + font-size: 24px; + font-style: italic; +} + +.results { + list-style-image: url('http://img-cache.cdn.gaiaonline.com/76bd5c99d8f2236e9d3672510e933fdf/http://i278.photobucket.com/albums/kk81/d3m3nt3dpr3p/Tiny-Star-Icon.png'); + list-style-position: inside; + padding: 0; +} + +.results li { + font-size: 18px; + margin-bottom: 16px; +} + +.star-count { + font-weight: bold; + margin-right: 16px; +} + +a { + color: rgb(96, 181, 204); + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +.search-query { + padding: 8px; + font-size: 24px; + margin-bottom: 18px; + margin-top: 36px; +} + +.search-button { + padding: 8px 16px; + font-size: 24px; + color: white; + border: 1px solid #ccc; + background-color: rgb(96, 181, 204); + margin-left: 12px +} + +.search-button:hover { + color: rgb(96, 181, 204); + background-color: white; +} + +.hide-result { + background-color: transparent; + border: 0; + font-weight: bold; + font-size: 18px; + margin-left: 18px; + cursor: pointer; +} + +.hide-result:hover { + color: rgb(96, 181, 204); +} + +button:focus, input:focus { + outline: none; +} diff --git a/stages/1/Main.elm b/stages/1/Main.elm index 4f34c41..ddcbdb2 100644 --- a/stages/1/Main.elm +++ b/stages/1/Main.elm @@ -2,7 +2,6 @@ module Main (..) where import Html exposing (..) import Html.Attributes exposing (..) -import Html.Events exposing (..) import StartApp.Simple as StartApp diff --git a/stages/2/README.md b/stages/2/README.md index f983179..f20ae3f 100644 --- a/stages/2/README.md +++ b/stages/2/README.md @@ -4,7 +4,7 @@ Stage 2 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,5 +13,5 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` diff --git a/stages/2/style.css b/stages/2/style.css index 8ee7f3b..5a5a285 100644 --- a/stages/2/style.css +++ b/stages/2/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } diff --git a/stages/3/README.md b/stages/3/README.md index 240a32e..fcf6d94 100644 --- a/stages/3/README.md +++ b/stages/3/README.md @@ -4,7 +4,7 @@ Stage 3 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,5 +13,5 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` diff --git a/stages/3/style.css b/stages/3/style.css index 8ee7f3b..5a5a285 100644 --- a/stages/3/style.css +++ b/stages/3/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } diff --git a/stages/4/README.md b/stages/4/README.md index 57149d5..80fedb5 100644 --- a/stages/4/README.md +++ b/stages/4/README.md @@ -4,7 +4,7 @@ Stage 4 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,5 +13,5 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` diff --git a/stages/4/style.css b/stages/4/style.css index 8ee7f3b..5a5a285 100644 --- a/stages/4/style.css +++ b/stages/4/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } diff --git a/stages/5/README.md b/stages/5/README.md index fb4648a..f50c90f 100644 --- a/stages/5/README.md +++ b/stages/5/README.md @@ -4,7 +4,7 @@ Stage 5 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,12 +13,12 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` ## Running Tests ```bash -$ cd test -$ elm test TestRunner.elm +cd test +elm test TestRunner.elm ``` diff --git a/stages/5/style.css b/stages/5/style.css index 8ee7f3b..5a5a285 100644 --- a/stages/5/style.css +++ b/stages/5/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } diff --git a/stages/6/README.md b/stages/6/README.md index 76ddac4..4e2d33e 100644 --- a/stages/6/README.md +++ b/stages/6/README.md @@ -4,7 +4,7 @@ Stage 5 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,13 +13,13 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` ## Running Tests ```bash -$ cd test -$ elm package install -$ elm test TestRunner.elm +cd test +elm package install +elm test TestRunner.elm ``` diff --git a/stages/6/style.css b/stages/6/style.css index 8ee7f3b..5a5a285 100644 --- a/stages/6/style.css +++ b/stages/6/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } diff --git a/stages/7/README.md b/stages/7/README.md index 76ddac4..4e2d33e 100644 --- a/stages/7/README.md +++ b/stages/7/README.md @@ -4,7 +4,7 @@ Stage 5 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,13 +13,13 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` ## Running Tests ```bash -$ cd test -$ elm package install -$ elm test TestRunner.elm +cd test +elm package install +elm test TestRunner.elm ``` diff --git a/stages/7/style.css b/stages/7/style.css index 8ee7f3b..5a5a285 100644 --- a/stages/7/style.css +++ b/stages/7/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } diff --git a/stages/8/README.md b/stages/8/README.md index 76ddac4..4e2d33e 100644 --- a/stages/8/README.md +++ b/stages/8/README.md @@ -4,7 +4,7 @@ Stage 5 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,13 +13,13 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` ## Running Tests ```bash -$ cd test -$ elm package install -$ elm test TestRunner.elm +cd test +elm package install +elm test TestRunner.elm ``` diff --git a/stages/8/style.css b/stages/8/style.css index 8ddef8d..5a5a285 100644 --- a/stages/8/style.css +++ b/stages/8/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } @@ -89,18 +89,3 @@ h1 { button:focus, input:focus { outline: none; } - -.expand-result { - padding: 4px 8px; - font-size: 16px; - color: white; - border: 1px solid #ccc; - background-color: rgb(96, 181, 204); - margin-left: 12px; - cursor: pointer; -} - -.expand-result:hover { - color: rgb(96, 181, 204); - background-color: white; -} diff --git a/stages/9/README.md b/stages/9/README.md index bc65db1..3f40f91 100644 --- a/stages/9/README.md +++ b/stages/9/README.md @@ -4,7 +4,7 @@ Stage 5 ## Installation ```bash -$ elm package install +elm package install ``` (Answer `y` at the prompt. In rare cases a known issue can cause the download @@ -13,11 +13,11 @@ to fail; in that case, just run `elm package install` again.) ## Building ```bash -$ elm live Main.elm --open -- --output=elm.js +elm live Main.elm --open -- --output=elm.js ``` ## Compiling CSS ```bash -$ elm test css/Stylesheets.elm +elm test css/Stylesheets.elm ``` diff --git a/stages/9/style.css b/stages/9/style.css index 8ddef8d..5a5a285 100644 --- a/stages/9/style.css +++ b/stages/9/style.css @@ -40,15 +40,15 @@ h1 { .star-count { font-weight: bold; + margin-right: 16px; } -.result-name { +a { color: rgb(96, 181, 204); - margin-left: 16px; text-decoration: none; } -.result-name:hover{ +a:hover { text-decoration: underline; } @@ -89,18 +89,3 @@ h1 { button:focus, input:focus { outline: none; } - -.expand-result { - padding: 4px 8px; - font-size: 16px; - color: white; - border: 1px solid #ccc; - background-color: rgb(96, 181, 204); - margin-left: 12px; - cursor: pointer; -} - -.expand-result:hover { - color: rgb(96, 181, 204); - background-color: white; -}