elm-pages-v3-beta/examples/docs/src/Page/Showcase.elm

86 lines
1.9 KiB
Elm
Raw Normal View History

module Page.Showcase exposing (Model, Msg, StaticData, page)
2021-04-20 17:31:19 +03:00
import DataSource
2021-04-13 02:54:08 +03:00
import Document exposing (Document)
import Element exposing (Element)
import Head
import Head.Seo as Seo
import Page exposing (PageWithState, StaticPayload)
import Pages.ImagePath as ImagePath
2020-09-12 19:15:24 +03:00
import Shared
import Showcase
2020-08-27 07:14:52 +03:00
type alias Model =
()
2020-09-24 19:04:15 +03:00
type alias Msg =
Never
page : PageWithState {} StaticData () Msg
page =
Page.withStaticData
2020-09-24 19:04:15 +03:00
{ head = head
2021-04-20 17:31:19 +03:00
, staticRoutes = DataSource.succeed []
2021-04-05 06:47:25 +03:00
, staticData = \_ -> staticData
}
|> Page.buildNoState { view = view }
staticData : DataSource.DataSource StaticData
2021-04-01 22:56:33 +03:00
staticData =
2021-04-03 01:47:07 +03:00
Showcase.staticRequest
2021-04-01 05:55:28 +03:00
--(StaticHttp.get
-- (Secrets.succeed "file://elm.json")
-- OptimizedDecoder.string
--)
type alias DataFromFile =
{ body : List (Element Msg), title : String }
2020-05-24 18:52:09 +03:00
type alias StaticData =
2021-04-03 01:47:07 +03:00
List Showcase.Entry
2020-05-24 18:52:09 +03:00
2020-08-25 07:56:38 +03:00
view :
2021-04-05 17:48:26 +03:00
StaticPayload StaticData {}
2021-04-13 02:54:08 +03:00
-> Document Msg
2021-04-03 01:21:17 +03:00
view static =
2020-05-24 18:52:09 +03:00
{ title = "elm-pages blog"
, body =
2021-04-01 05:55:28 +03:00
let
2021-04-03 01:47:07 +03:00
showcaseEntries =
2021-04-01 05:55:28 +03:00
static.static
in
[ Element.column [ Element.width Element.fill ]
2021-04-03 01:47:07 +03:00
[ Element.column [ Element.padding 20, Element.centerX ] [ Showcase.view showcaseEntries ]
2020-05-24 18:52:09 +03:00
]
]
|> Document.ElmUiView
}
2021-04-10 23:51:39 +03:00
head : StaticPayload StaticData {} -> List Head.Tag
2020-09-06 22:42:05 +03:00
head staticPayload =
2020-05-24 18:52:09 +03:00
Seo.summary
{ canonicalUrlOverride = Nothing
, siteName = "elm-pages"
, image =
{ url = ImagePath.build [ "images", "icon-png.png" ]
2020-05-24 18:52:09 +03:00
, alt = "elm-pages logo"
, dimensions = Nothing
, mimeType = Nothing
}
, description = "See some neat sites built using elm-pages! (Or submit yours!)"
, locale = Nothing
, title = "elm-pages sites showcase"
}
|> Seo.website