-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an example and a test to prevent regressions
- Loading branch information
1 parent
4097dca
commit e6789f5
Showing
11 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/dist | ||
/.elm-land | ||
/.env | ||
/elm-stuff | ||
/node_modules | ||
.DS_Store | ||
*.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"app": { | ||
"elm": { | ||
"development": { "debugger": true }, | ||
"production": { "debugger": false } | ||
}, | ||
"env": [], | ||
"html": { | ||
"attributes": { | ||
"html": { "lang": "en" }, | ||
"head": {} | ||
}, | ||
"title": "Elm Land", | ||
"meta": [ | ||
{ "charset": "UTF-8" }, | ||
{ "http-equiv": "X-UA-Compatible", "content": "IE=edge" }, | ||
{ "name": "viewport", "content": "width=device-width, initial-scale=1.0" } | ||
], | ||
"link": [ | ||
{ "rel": "stylesheet", "href": "/main.css" } | ||
], | ||
"script": [] | ||
}, | ||
"router": { | ||
"useHashRouting": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"type": "application", | ||
"source-directories": [ | ||
"src", | ||
".elm-land/src" | ||
], | ||
"elm-version": "0.19.1", | ||
"dependencies": { | ||
"direct": { | ||
"elm/browser": "1.0.2", | ||
"elm/core": "1.0.5", | ||
"elm/html": "1.0.0", | ||
"elm/json": "1.1.3", | ||
"elm/url": "1.0.0" | ||
}, | ||
"indirect": { | ||
"elm/time": "1.0.0", | ||
"elm/virtual-dom": "1.0.3" | ||
} | ||
}, | ||
"test-dependencies": { | ||
"direct": {}, | ||
"indirect": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
module Pages.Home_ exposing (page) | ||
|
||
import Html exposing (..) | ||
import Html.Attributes exposing (..) | ||
import Route.Path | ||
import View exposing (View) | ||
|
||
|
||
type alias Link = | ||
{ label : String | ||
, path : Route.Path.Path | ||
} | ||
|
||
|
||
page : View msg | ||
page = | ||
{ title = "Homepage" | ||
, body = | ||
[ h1 [] [ text "🏡 Homepage" ] | ||
, p [] [ text "Click a link below to learn how URLs work in Elm Land" ] | ||
, section [] | ||
[ h3 [] [ text "🧑\u{200D}💻 Users" ] | ||
, viewLinks | ||
[ { label = "@elm-land" | ||
, path = Route.Path.User_ { user = "elm-land" } | ||
} | ||
, { label = "@ryannhg" | ||
, path = Route.Path.User_ { user = "ryannhg" } | ||
} | ||
, { label = "@elm" | ||
, path = Route.Path.User_ { user = "elm" } | ||
} | ||
] | ||
] | ||
, section [] | ||
[ h3 [] [ text "📦 Repos" ] | ||
, viewLinks | ||
[ { label = "@elm-land/vscode" | ||
, path = | ||
Route.Path.User__Repo_ | ||
{ user = "elm-land" | ||
, repo = "vscode" | ||
} | ||
} | ||
, { label = "@ryannhg/graphql" | ||
, path = | ||
Route.Path.User__Repo_ | ||
{ user = "ryannhg" | ||
, repo = "graphql" | ||
} | ||
} | ||
, { label = "@elm/compiler" | ||
, path = | ||
Route.Path.User__Repo_ | ||
{ user = "elm" | ||
, repo = "compiler" | ||
} | ||
} | ||
] | ||
] | ||
, section [] | ||
[ h3 [] [ text "🗃 File Explorer" ] | ||
, viewLinks | ||
[ { label = "README from @elm-land/vscode" | ||
, path = | ||
Route.Path.User__Repo__Tree_Branch__ALL_ | ||
{ user = "elm-land" | ||
, repo = "vscode" | ||
, branch = "main" | ||
, all_ = [ "README.md" ] | ||
} | ||
} | ||
, { label = "`Decode.elm` from @ryannhg/graphql" | ||
, path = | ||
Route.Path.User__Repo__Tree_Branch__ALL_ | ||
{ user = "ryannhg" | ||
, repo = "graphql" | ||
, branch = "main" | ||
, all_ = [ "src", "GraphQL", "Decode.elm" ] | ||
} | ||
} | ||
, { label = "`Compile.hs` from @elm/compiler" | ||
, path = | ||
Route.Path.User__Repo__Tree_Branch__ALL_ | ||
{ user = "elm" | ||
, repo = "compiler" | ||
, branch = "master" | ||
, all_ = [ "compiler", "src", "Compile.hs" ] | ||
} | ||
} | ||
] | ||
] | ||
] | ||
} | ||
|
||
|
||
viewLinks : List Link -> Html msg | ||
viewLinks links = | ||
ul [] (List.map viewLink links) | ||
|
||
|
||
viewLink : Link -> Html msg | ||
viewLink link = | ||
li [] | ||
[ a [ Route.Path.href link.path ] [ text link.label ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module Pages.User_ exposing (page) | ||
|
||
import Html exposing (..) | ||
import Route.Path | ||
import View exposing (View) | ||
|
||
|
||
page : { user : String } -> View msg | ||
page params = | ||
{ title = "@" ++ params.user ++ " | Users" | ||
, body = | ||
[ h1 [] [ text ("🧑\u{200D}💻 @" ++ params.user) ] | ||
, p [] [ text "Hello from `src/Pages/User_.elm 👋" ] | ||
, a [ Route.Path.href Route.Path.Home_ ] [ text "Back to homepage" ] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module Pages.User_.Repo_ exposing (page) | ||
|
||
import Html exposing (..) | ||
import Route.Path | ||
import View exposing (View) | ||
|
||
|
||
page : { user : String, repo : String } -> View msg | ||
page params = | ||
{ title = "@" ++ params.user ++ "/" ++ params.repo ++ " | Repos" | ||
, body = | ||
[ h1 [] [ text ("📦 @" ++ params.user ++ "/" ++ params.repo) ] | ||
, p [] [ text "Hello from `src/Pages/User_/Repo_.elm 👋" ] | ||
, a [ Route.Path.href Route.Path.Home_ ] [ text "Back to homepage" ] | ||
] | ||
} |
22 changes: 22 additions & 0 deletions
22
examples/09-catch-all-routes/src/Pages/User_/Repo_/Tree/Branch_/ALL_.elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Pages.User_.Repo_.Tree.Branch_.ALL_ exposing (page) | ||
|
||
import Html exposing (..) | ||
import Route.Path | ||
import View exposing (View) | ||
|
||
|
||
page : | ||
{ user : String | ||
, repo : String | ||
, branch : String | ||
, all_ : List String | ||
} | ||
-> View msg | ||
page params = | ||
{ title = "@" ++ params.user ++ "/" ++ params.repo ++ " | File Explorer" | ||
, body = | ||
[ h1 [] [ text ("🗃 ~/" ++ String.join "/" params.all_) ] | ||
, p [] [ text "Hello from `src/Pages/User_/Repo_/Tree/Branch_/ALL_.elm 👋" ] | ||
, a [ Route.Path.href Route.Path.Home_ ] [ text "Back to homepage" ] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
body { | ||
margin: 2rem auto; | ||
padding: 0 2rem; | ||
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; | ||
max-width: 40em; | ||
} | ||
|
||
p { | ||
color: #555; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters