2020-06-07 02:10:18 +03:00
|
|
|
module Template.Showcase exposing (Model, Msg, decoder, template)
|
2020-05-20 16:42:52 +03:00
|
|
|
|
|
|
|
import Element exposing (Element)
|
2020-08-25 07:56:38 +03:00
|
|
|
import Global
|
2020-08-23 03:37:00 +03:00
|
|
|
import GlobalMetadata
|
2020-05-20 16:42:52 +03:00
|
|
|
import Head
|
|
|
|
import Head.Seo as Seo
|
2020-05-24 03:03:28 +03:00
|
|
|
import Json.Decode as Decode exposing (Decoder)
|
2020-05-20 16:42:52 +03:00
|
|
|
import MarkdownRenderer
|
|
|
|
import Pages exposing (images)
|
2020-05-24 18:52:09 +03:00
|
|
|
import Pages.PagePath as PagePath exposing (PagePath)
|
2020-05-20 16:42:52 +03:00
|
|
|
import Pages.StaticHttp as StaticHttp
|
|
|
|
import Showcase
|
2020-06-07 02:10:18 +03:00
|
|
|
import Template
|
|
|
|
import TemplateDocument exposing (TemplateDocument)
|
2020-08-23 18:00:49 +03:00
|
|
|
import TemplateMetadata exposing (Showcase)
|
2020-05-20 16:42:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
= Msg
|
|
|
|
|
|
|
|
|
2020-08-25 07:56:38 +03:00
|
|
|
template : TemplateDocument Showcase StaticData Model Msg msg
|
2020-06-07 02:10:18 +03:00
|
|
|
template =
|
|
|
|
Template.template
|
|
|
|
{ view = view
|
|
|
|
, head = head
|
|
|
|
, staticData = staticData
|
|
|
|
, init = init
|
|
|
|
, update = update
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
update : Showcase -> Msg -> Model -> ( Model, Cmd Msg )
|
|
|
|
update metadata msg model =
|
|
|
|
( Model, Cmd.none )
|
|
|
|
|
|
|
|
|
2020-05-27 22:58:11 +03:00
|
|
|
decoder : Decoder Showcase
|
2020-05-24 03:03:28 +03:00
|
|
|
decoder =
|
2020-05-27 22:58:11 +03:00
|
|
|
Decode.succeed Showcase
|
2020-05-24 03:03:28 +03:00
|
|
|
|
|
|
|
|
2020-05-24 18:52:09 +03:00
|
|
|
staticData : a -> StaticHttp.Request StaticData
|
|
|
|
staticData siteMetadata =
|
|
|
|
Showcase.staticRequest
|
2020-05-20 16:42:52 +03:00
|
|
|
|
2020-05-24 18:52:09 +03:00
|
|
|
|
|
|
|
type alias StaticData =
|
|
|
|
List Showcase.Entry
|
|
|
|
|
|
|
|
|
2020-06-07 02:10:18 +03:00
|
|
|
init : Showcase -> ( Model, Cmd Msg )
|
2020-05-24 18:52:09 +03:00
|
|
|
init metadata =
|
2020-06-07 02:10:18 +03:00
|
|
|
( Model, Cmd.none )
|
2020-05-20 16:42:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
type alias Model =
|
2020-05-24 18:52:09 +03:00
|
|
|
{}
|
2020-05-20 16:42:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
type alias View msg =
|
|
|
|
( MarkdownRenderer.TableOfContents, List (Element msg) )
|
|
|
|
|
|
|
|
|
2020-08-25 07:56:38 +03:00
|
|
|
view :
|
|
|
|
(Msg -> msg)
|
|
|
|
-> (Global.Msg -> msg)
|
|
|
|
-> List ( PagePath Pages.PathKey, GlobalMetadata.Metadata )
|
|
|
|
-> StaticData
|
|
|
|
-> Model
|
|
|
|
-> Showcase
|
|
|
|
-> Global.RenderedBody Never
|
|
|
|
-> { title : String, body : Element Never }
|
|
|
|
view toMsg toGlobalMsg allMetadata static model metadata rendered =
|
2020-05-24 18:52:09 +03:00
|
|
|
{ title = "elm-pages blog"
|
|
|
|
, body =
|
|
|
|
Element.column [ Element.width Element.fill ]
|
2020-08-25 07:56:38 +03:00
|
|
|
[ Element.column [ Element.padding 20, Element.centerX ] [ Showcase.view static ]
|
2020-05-24 18:52:09 +03:00
|
|
|
]
|
2020-05-20 16:42:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-27 22:58:11 +03:00
|
|
|
head : StaticData -> PagePath.PagePath Pages.PathKey -> Showcase -> List (Head.Tag Pages.PathKey)
|
2020-05-24 18:52:09 +03:00
|
|
|
head static currentPath metadata =
|
|
|
|
Seo.summary
|
|
|
|
{ canonicalUrlOverride = Nothing
|
|
|
|
, siteName = "elm-pages"
|
|
|
|
, image =
|
|
|
|
{ url = images.iconPng
|
|
|
|
, 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
|