mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-08 07:29:08 +03:00
Use sandbox for Template.Page.
This commit is contained in:
parent
9497438f8c
commit
2996470c17
@ -2,64 +2,44 @@ module Template.Page exposing (Model, Msg, decoder, template)
|
|||||||
|
|
||||||
import Element exposing (Element)
|
import Element exposing (Element)
|
||||||
import Element.Region
|
import Element.Region
|
||||||
import GlobalMetadata
|
|
||||||
import Head
|
import Head
|
||||||
import Head.Seo as Seo
|
import Head.Seo as Seo
|
||||||
import Json.Decode as Decode
|
import Json.Decode as Decode
|
||||||
import Pages exposing (images)
|
import Pages exposing (images)
|
||||||
import Pages.PagePath as PagePath exposing (PagePath)
|
import Pages.PagePath exposing (PagePath)
|
||||||
import Pages.StaticHttp as StaticHttp
|
|
||||||
import Shared
|
import Shared
|
||||||
import Site
|
import Site
|
||||||
import Template exposing (StaticPayload, Template)
|
import Template exposing (StaticPayload, Template)
|
||||||
import TemplateMetadata exposing (Page)
|
import TemplateMetadata exposing (Page)
|
||||||
|
|
||||||
|
|
||||||
type alias StaticData =
|
|
||||||
()
|
|
||||||
|
|
||||||
|
|
||||||
type alias Model =
|
type alias Model =
|
||||||
()
|
()
|
||||||
|
|
||||||
|
|
||||||
type Msg
|
type alias Msg =
|
||||||
= Msg
|
Never
|
||||||
|
|
||||||
|
|
||||||
template : Template Page () () Msg
|
template : Template.TemplateSandbox Page
|
||||||
template =
|
template =
|
||||||
Template.simplest
|
Template.sandbox
|
||||||
{ view = view
|
{ view = view
|
||||||
, head = head
|
, head = head
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init : Page -> ( Model, Cmd Msg )
|
|
||||||
init metadata =
|
|
||||||
( (), Cmd.none )
|
|
||||||
|
|
||||||
|
|
||||||
update : Page -> Msg -> Model -> ( Model, Cmd Msg )
|
|
||||||
update metadata msg model =
|
|
||||||
( (), Cmd.none )
|
|
||||||
|
|
||||||
|
|
||||||
staticData :
|
|
||||||
List ( PagePath Pages.PathKey, GlobalMetadata.Metadata )
|
|
||||||
-> StaticHttp.Request StaticData
|
|
||||||
staticData siteMetadata =
|
|
||||||
StaticHttp.succeed ()
|
|
||||||
|
|
||||||
|
|
||||||
decoder : Decode.Decoder Page
|
decoder : Decode.Decoder Page
|
||||||
decoder =
|
decoder =
|
||||||
Decode.map Page
|
Decode.map Page
|
||||||
(Decode.field "title" Decode.string)
|
(Decode.field "title" Decode.string)
|
||||||
|
|
||||||
|
|
||||||
head : StaticPayload Page () -> List (Head.Tag Pages.PathKey)
|
head :
|
||||||
head staticPayload =
|
Page
|
||||||
|
-> PagePath Pages.PathKey
|
||||||
|
-> List (Head.Tag Pages.PathKey)
|
||||||
|
head metadata path =
|
||||||
Seo.summary
|
Seo.summary
|
||||||
{ canonicalUrlOverride = Nothing
|
{ canonicalUrlOverride = Nothing
|
||||||
, siteName = "elm-pages"
|
, siteName = "elm-pages"
|
||||||
@ -71,18 +51,18 @@ head staticPayload =
|
|||||||
}
|
}
|
||||||
, description = Site.tagline
|
, description = Site.tagline
|
||||||
, locale = Nothing
|
, locale = Nothing
|
||||||
, title = staticPayload.metadata.title
|
, title = metadata.title
|
||||||
}
|
}
|
||||||
|> Seo.website
|
|> Seo.website
|
||||||
|
|
||||||
|
|
||||||
view :
|
view :
|
||||||
List ( PagePath Pages.PathKey, GlobalMetadata.Metadata )
|
Page
|
||||||
-> StaticPayload Page ()
|
-> PagePath Pages.PathKey
|
||||||
-> Shared.RenderedBody
|
-> Shared.RenderedBody
|
||||||
-> Shared.PageView Msg
|
-> Shared.PageView msg
|
||||||
view allMetadata staticPayload rendered =
|
view metadata path rendered =
|
||||||
{ title = staticPayload.metadata.title
|
{ title = metadata.title
|
||||||
, body =
|
, body =
|
||||||
[ Element.column
|
[ Element.column
|
||||||
[ Element.padding 50
|
[ Element.padding 50
|
||||||
|
Loading…
Reference in New Issue
Block a user