Update example.

This commit is contained in:
Dillon Kearns 2021-05-24 12:09:57 -07:00
parent 959487cda0
commit 1fc19583a2
6 changed files with 34 additions and 14 deletions

View File

@ -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")
]

View File

@ -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
]

View File

@ -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
]

View File

@ -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 = []
}

View File

@ -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

View File

@ -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 =