mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-29 14:56:36 +03:00
Update example.
This commit is contained in:
parent
959487cda0
commit
1fc19583a2
@ -5,7 +5,9 @@ import Head
|
||||
import Head.Seo as Seo
|
||||
import Html.Styled exposing (text)
|
||||
import Page exposing (Page, PageWithState, StaticPayload)
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
import Pages.Url
|
||||
import Shared
|
||||
import View exposing (View)
|
||||
|
||||
|
||||
@ -71,9 +73,11 @@ type alias Data =
|
||||
|
||||
|
||||
view :
|
||||
StaticPayload Data RouteParams
|
||||
Maybe PageUrl
|
||||
-> Shared.Model
|
||||
-> StaticPayload Data RouteParams
|
||||
-> View Msg
|
||||
view static =
|
||||
view maybeUrl sharedModel static =
|
||||
{ body =
|
||||
[ text (static.routeParams.name |> Maybe.withDefault "NOTHING")
|
||||
]
|
||||
|
@ -4,6 +4,8 @@ import DataSource
|
||||
import Head
|
||||
import Html.Styled exposing (text)
|
||||
import Page exposing (Page, PageWithState, StaticPayload)
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
import Shared
|
||||
import View exposing (View)
|
||||
|
||||
|
||||
@ -58,9 +60,11 @@ type alias Data =
|
||||
|
||||
|
||||
view :
|
||||
StaticPayload Data RouteParams
|
||||
Maybe PageUrl
|
||||
-> Shared.Model
|
||||
-> StaticPayload Data RouteParams
|
||||
-> View Msg
|
||||
view static =
|
||||
view maybeUrl sharedModel static =
|
||||
{ body =
|
||||
[ Debug.toString static.routeParams |> text
|
||||
]
|
||||
|
@ -4,6 +4,8 @@ import DataSource
|
||||
import Head
|
||||
import Html.Styled exposing (text)
|
||||
import Page exposing (Page, PageWithState, StaticPayload)
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
import Shared
|
||||
import View exposing (View)
|
||||
|
||||
|
||||
@ -48,9 +50,11 @@ type alias Data =
|
||||
|
||||
|
||||
view :
|
||||
StaticPayload Data RouteParams
|
||||
Maybe PageUrl
|
||||
-> Shared.Model
|
||||
-> StaticPayload Data RouteParams
|
||||
-> View Msg
|
||||
view static =
|
||||
view maybeUrl sharedModel static =
|
||||
{ body =
|
||||
[ Debug.toString static.routeParams |> text
|
||||
]
|
||||
|
@ -4,7 +4,9 @@ import DataSource
|
||||
import Head
|
||||
import Head.Seo as Seo
|
||||
import Page exposing (Page, PageWithState, StaticPayload)
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
import Pages.Url
|
||||
import Shared
|
||||
import View exposing (View)
|
||||
|
||||
|
||||
@ -54,9 +56,11 @@ type alias Data =
|
||||
|
||||
|
||||
view :
|
||||
StaticPayload Data RouteParams
|
||||
Maybe PageUrl
|
||||
-> Shared.Model
|
||||
-> StaticPayload Data RouteParams
|
||||
-> View Msg
|
||||
view static =
|
||||
view maybeUrl sharedModel static =
|
||||
{ title = "TODO title"
|
||||
, body = []
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import Markdown.Renderer
|
||||
import MarkdownRenderer
|
||||
import OptimizedDecoder
|
||||
import Page exposing (Page, StaticPayload)
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
import Pages.Url
|
||||
import Shared
|
||||
import Tailwind.Utilities as Tw
|
||||
@ -49,9 +50,9 @@ page =
|
||||
}
|
||||
|> Page.buildWithLocalState
|
||||
{ view = view
|
||||
, init = \staticPayload -> ( (), Cmd.none )
|
||||
, init = \_ _ staticPayload -> ( (), Cmd.none )
|
||||
, update =
|
||||
\sharedModel static msg model ->
|
||||
\_ maybeNavigationKey sharedModel static msg model ->
|
||||
case msg of
|
||||
OnKeyPress (Just direction) ->
|
||||
let
|
||||
@ -71,7 +72,7 @@ page =
|
||||
)
|
||||
in
|
||||
( model
|
||||
, sharedModel.navigationKey
|
||||
, maybeNavigationKey
|
||||
|> Maybe.map
|
||||
(\navKey ->
|
||||
Browser.Navigation.pushUrl navKey
|
||||
@ -86,7 +87,7 @@ page =
|
||||
_ ->
|
||||
( model, Cmd.none )
|
||||
, subscriptions =
|
||||
\routeParams path model ->
|
||||
\maybePageUrl routeParams path model ->
|
||||
Browser.Events.onKeyDown keyDecoder |> Sub.map OnKeyPress
|
||||
}
|
||||
|
||||
@ -234,11 +235,12 @@ type alias Data =
|
||||
|
||||
|
||||
view :
|
||||
Model
|
||||
Maybe PageUrl
|
||||
-> Shared.Model
|
||||
-> Model
|
||||
-> StaticPayload Data RouteParams
|
||||
-> View Msg
|
||||
view model sharedModel static =
|
||||
view maybeUrl sharedModel model static =
|
||||
{ title = "TODO title"
|
||||
, body =
|
||||
[ Html.div
|
||||
|
@ -8,6 +8,7 @@ import Html exposing (Html)
|
||||
import Html.Styled
|
||||
import OptimizedDecoder as D
|
||||
import Pages.Flags
|
||||
import Pages.PageUrl exposing (PageUrl)
|
||||
import Path exposing (Path)
|
||||
import Secrets
|
||||
import SharedTemplate exposing (SharedTemplate)
|
||||
@ -60,6 +61,7 @@ init :
|
||||
, fragment : Maybe String
|
||||
}
|
||||
, metadata : route
|
||||
, pageUrl : Maybe PageUrl
|
||||
}
|
||||
-> ( Model, Cmd Msg )
|
||||
init _ flags maybePagePath =
|
||||
|
Loading…
Reference in New Issue
Block a user