Bump 10 and 11, introduce new 9
This commit is contained in:
@@ -26,12 +26,8 @@ type Action
|
|||||||
|
|
||||||
update : Action -> Model -> ( Model, Effects Action )
|
update : Action -> Model -> ( Model, Effects Action )
|
||||||
update action model =
|
update action model =
|
||||||
case action of
|
-- TODO make expand and collapse work
|
||||||
Expand ->
|
( model, Effects.none )
|
||||||
( { model | expanded = True }, Effects.none )
|
|
||||||
|
|
||||||
Collapse ->
|
|
||||||
( { model | expanded = False }, Effects.none )
|
|
||||||
|
|
||||||
|
|
||||||
view : Address Action -> Model -> Html
|
view : Address Action -> Model -> Html
|
||||||
@@ -44,11 +40,13 @@ view address model =
|
|||||||
[ href ("https://github.com/" ++ model.name), target "_blank" ]
|
[ href ("https://github.com/" ++ model.name), target "_blank" ]
|
||||||
[ text model.name ]
|
[ text model.name ]
|
||||||
, button
|
, button
|
||||||
[ class "hide-result", onClick address Collapse ]
|
-- TODO when the user clicks, send a Collapse action
|
||||||
|
[ class "hide-result" ]
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
[ button
|
[ button
|
||||||
[ class "expand-result", onClick address Expand ]
|
-- TODO when the user clicks, send an Expand action
|
||||||
|
[ class "expand-result" ]
|
||||||
[ text "Show" ]
|
[ text "Show" ]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ to fail; in that case, just run `elm package install` again.)
|
|||||||
elm live Main.elm --open -- --output=elm.js
|
elm live Main.elm --open -- --output=elm.js
|
||||||
```
|
```
|
||||||
|
|
||||||
## Compiling CSS
|
## Running Tests
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
elm test css/Stylesheets.elm
|
cd test
|
||||||
|
elm package install
|
||||||
|
elm test TestRunner.elm
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
"evancz/elm-effects": "2.0.0 <= v < 3.0.0",
|
"evancz/elm-effects": "2.0.0 <= v < 3.0.0",
|
||||||
"evancz/elm-html": "4.0.0 <= v < 5.0.0",
|
"evancz/elm-html": "4.0.0 <= v < 5.0.0",
|
||||||
"evancz/elm-http": "3.0.0 <= v < 4.0.0",
|
"evancz/elm-http": "3.0.0 <= v < 4.0.0",
|
||||||
"evancz/start-app": "2.0.0 <= v < 3.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"
|
"elm-version": "0.16.0 <= v < 0.17.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,8 +26,12 @@ type Action
|
|||||||
|
|
||||||
update : Action -> Model -> ( Model, Effects Action )
|
update : Action -> Model -> ( Model, Effects Action )
|
||||||
update action model =
|
update action model =
|
||||||
-- TODO make expand and collapse work
|
case action of
|
||||||
( model, Effects.none )
|
Expand ->
|
||||||
|
( { model | expanded = True }, Effects.none )
|
||||||
|
|
||||||
|
Collapse ->
|
||||||
|
( { model | expanded = False }, Effects.none )
|
||||||
|
|
||||||
|
|
||||||
view : Address Action -> Model -> Html
|
view : Address Action -> Model -> Html
|
||||||
@@ -40,13 +44,11 @@ view address model =
|
|||||||
[ href ("https://github.com/" ++ model.name), target "_blank" ]
|
[ href ("https://github.com/" ++ model.name), target "_blank" ]
|
||||||
[ text model.name ]
|
[ text model.name ]
|
||||||
, button
|
, button
|
||||||
-- TODO when the user clicks, send a Collapse action
|
[ class "hide-result", onClick address Collapse ]
|
||||||
[ class "hide-result" ]
|
|
||||||
[ text "X" ]
|
[ text "X" ]
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
[ button
|
[ button
|
||||||
-- TODO when the user clicks, send an Expand action
|
[ class "expand-result", onClick address Expand ]
|
||||||
[ class "expand-result" ]
|
|
||||||
[ text "Show" ]
|
[ text "Show" ]
|
||||||
]
|
]
|
||||||
27
stages/11/Main.elm
Normal file
27
stages/11/Main.elm
Normal file
@@ -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
|
||||||
23
stages/11/README.md
Normal file
23
stages/11/README.md
Normal file
@@ -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
|
||||||
|
```
|
||||||
BIN
stages/11/elm-hub.png
Normal file
BIN
stages/11/elm-hub.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
19
stages/11/elm-package.json
Normal file
19
stages/11/elm-package.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
26
stages/11/index.html
Normal file
26
stages/11/index.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>ElmHub</title>
|
||||||
|
<script type="text/javascript" src="elm.js"></script>
|
||||||
|
|
||||||
|
<!-- Uncomment the below line to enable elm-reactor support. -->
|
||||||
|
<!-- <script type="text/javascript" src="/_reactor/debug.js"></script> -->
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<link rel="icon" type="image/png" href="elm-hub.png">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var app = Elm.fullscreen(Elm.Main, {});
|
||||||
|
|
||||||
|
// Uncomment this line and comment out the above to enable elm-reactor support.
|
||||||
|
// var app = Elm.fullscreenDebug("ElmHub", "Main.elm");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
92
stages/11/style.css
Normal file
92
stages/11/style.css
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
|
||||||
|
.content {
|
||||||
|
width: 960px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 30px;
|
||||||
|
font-family: Helvetica, Arial, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
position: relative;
|
||||||
|
padding: 6px 12px;
|
||||||
|
height: 36px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
15
stages/11/test/TestRunner.elm
Normal file
15
stages/11/test/TestRunner.elm
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
module Main where
|
||||||
|
|
||||||
|
import Signal exposing (Signal)
|
||||||
|
|
||||||
|
import ElmTest exposing (consoleRunner)
|
||||||
|
import Console exposing (IO, run)
|
||||||
|
import Task
|
||||||
|
|
||||||
|
import Tests
|
||||||
|
|
||||||
|
console : IO ()
|
||||||
|
console = consoleRunner Tests.all
|
||||||
|
|
||||||
|
port runner : Signal (Task.Task x ())
|
||||||
|
port runner = run console
|
||||||
35
stages/11/test/Tests.elm
Normal file
35
stages/11/test/Tests.elm
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
module Tests (..) where
|
||||||
|
|
||||||
|
import ElmTest exposing (..)
|
||||||
|
import ElmHub exposing (responseDecoder)
|
||||||
|
import Json.Decode exposing (decodeString)
|
||||||
|
|
||||||
|
|
||||||
|
all : Test
|
||||||
|
all =
|
||||||
|
suite
|
||||||
|
"Decoding responses from GitHub"
|
||||||
|
[ test "they can decode empty responses"
|
||||||
|
<| let
|
||||||
|
emptyResponse =
|
||||||
|
"""{ "items": [] }"""
|
||||||
|
in
|
||||||
|
assertEqual
|
||||||
|
(decodeString responseDecoder emptyResponse)
|
||||||
|
(Ok [])
|
||||||
|
, test "they can decode responses with results in them"
|
||||||
|
<| let
|
||||||
|
response =
|
||||||
|
"""{ "items": [
|
||||||
|
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
|
||||||
|
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
|
||||||
|
] }"""
|
||||||
|
in
|
||||||
|
assertEqual
|
||||||
|
(decodeString responseDecoder response)
|
||||||
|
(Ok
|
||||||
|
[ { id = 5, name = "foo", stars = 42 }
|
||||||
|
, { id = 3, name = "bar", stars = 77 }
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
21
stages/11/test/elm-package.json
Normal file
21
stages/11/test/elm-package.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"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": {
|
||||||
|
"deadfoxygrandpa/elm-test": "3.1.1 <= v < 4.0.0",
|
||||||
|
"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",
|
||||||
|
"laszlopandy/elm-console": "1.0.3 <= v < 2.0.0"
|
||||||
|
},
|
||||||
|
"elm-version": "0.16.0 <= v < 0.17.0"
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
module Main (..) where
|
module Main (..) where
|
||||||
|
|
||||||
import StartApp
|
import StartApp
|
||||||
import Component.ElmHub exposing (..)
|
import ElmHub exposing (..)
|
||||||
import Effects exposing (Effects)
|
import Effects exposing (Effects)
|
||||||
import Task exposing (Task)
|
import Task exposing (Task)
|
||||||
import Html exposing (Html)
|
import Html exposing (Html)
|
||||||
|
|||||||
Reference in New Issue
Block a user