add: Single Page routing
This commit is contained in:
28
Modules/Website/src/Route.elm
Normal file
28
Modules/Website/src/Route.elm
Normal file
@@ -0,0 +1,28 @@
|
||||
module Route exposing (..)
|
||||
|
||||
import Url exposing (Url)
|
||||
import Url.Parser exposing (..)
|
||||
|
||||
|
||||
type Route
|
||||
= NotFound
|
||||
| Home
|
||||
| Files
|
||||
|
||||
|
||||
parseUrl : Url -> Route
|
||||
parseUrl url =
|
||||
case parse matchRoute url of
|
||||
Just route ->
|
||||
route
|
||||
|
||||
Nothing ->
|
||||
NotFound
|
||||
|
||||
|
||||
matchRoute : Parser (Route -> a) a
|
||||
matchRoute =
|
||||
oneOf
|
||||
[ map Home top
|
||||
, map Files (s "files")
|
||||
]
|
||||
Reference in New Issue
Block a user