2022-05-12 01:27:37 +03:00
|
|
|
module Route.Showcase exposing (ActionData, Data, Model, Msg, route)
|
2020-05-20 16:42:52 +03:00
|
|
|
|
2023-01-02 01:44:11 +03:00
|
|
|
import BackendTask exposing (BackendTask)
|
2021-05-10 23:48:20 +03:00
|
|
|
import Css
|
2023-01-17 21:54:01 +03:00
|
|
|
import FatalError exposing (FatalError)
|
2020-05-20 16:42:52 +03:00
|
|
|
import Head
|
|
|
|
import Head.Seo as Seo
|
2021-05-10 23:48:20 +03:00
|
|
|
import Html.Styled exposing (..)
|
|
|
|
import Html.Styled.Attributes as Attr exposing (css, href)
|
2022-05-19 19:38:15 +03:00
|
|
|
import Pages.Msg
|
2021-05-24 21:17:34 +03:00
|
|
|
import Pages.PageUrl exposing (PageUrl)
|
2021-05-24 01:11:46 +03:00
|
|
|
import Pages.Url
|
|
|
|
import Path
|
2022-03-05 20:50:01 +03:00
|
|
|
import RouteBuilder exposing (StatefulRoute, StaticPayload)
|
2021-05-24 22:01:17 +03:00
|
|
|
import Shared
|
2020-05-20 16:42:52 +03:00
|
|
|
import Showcase
|
2021-05-10 23:48:20 +03:00
|
|
|
import Tailwind.Breakpoints as Bp
|
|
|
|
import Tailwind.Utilities as Tw
|
2021-05-23 19:00:20 +03:00
|
|
|
import View exposing (View)
|
2020-05-20 16:42:52 +03:00
|
|
|
|
|
|
|
|
2020-08-27 07:14:52 +03:00
|
|
|
type alias Model =
|
2021-12-10 20:52:12 +03:00
|
|
|
{}
|
2020-08-27 07:14:52 +03:00
|
|
|
|
|
|
|
|
2020-09-24 19:04:15 +03:00
|
|
|
type alias Msg =
|
2022-01-26 20:47:18 +03:00
|
|
|
()
|
2020-05-20 16:42:52 +03:00
|
|
|
|
|
|
|
|
2021-04-24 22:47:22 +03:00
|
|
|
type alias RouteParams =
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2022-05-12 01:27:37 +03:00
|
|
|
route : StatefulRoute RouteParams Data ActionData Model Msg
|
2022-03-05 21:35:17 +03:00
|
|
|
route =
|
2022-03-05 20:50:01 +03:00
|
|
|
RouteBuilder.single
|
2020-09-24 19:04:15 +03:00
|
|
|
{ head = head
|
2021-04-24 22:47:22 +03:00
|
|
|
, data = data
|
2020-06-07 02:10:18 +03:00
|
|
|
}
|
2022-03-05 20:50:01 +03:00
|
|
|
|> RouteBuilder.buildNoState { view = view }
|
2020-06-07 02:10:18 +03:00
|
|
|
|
|
|
|
|
2023-01-17 02:22:44 +03:00
|
|
|
data : BackendTask FatalError Data
|
2021-04-24 02:22:23 +03:00
|
|
|
data =
|
2021-04-03 01:47:07 +03:00
|
|
|
Showcase.staticRequest
|
2021-04-01 05:55:28 +03:00
|
|
|
|
|
|
|
|
2021-04-24 02:22:23 +03:00
|
|
|
type alias Data =
|
2021-04-03 01:47:07 +03:00
|
|
|
List Showcase.Entry
|
2020-05-24 18:52:09 +03:00
|
|
|
|
|
|
|
|
2022-05-12 01:27:37 +03:00
|
|
|
type alias ActionData =
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
2020-08-25 07:56:38 +03:00
|
|
|
view :
|
2021-05-24 21:17:34 +03:00
|
|
|
Maybe PageUrl
|
2021-05-24 22:01:17 +03:00
|
|
|
-> Shared.Model
|
2022-05-12 01:27:37 +03:00
|
|
|
-> StaticPayload Data ActionData {}
|
2022-05-19 19:38:15 +03:00
|
|
|
-> View (Pages.Msg.Msg Msg)
|
2021-05-24 22:01:17 +03:00
|
|
|
view maybeUrl sharedModel static =
|
2020-05-24 18:52:09 +03:00
|
|
|
{ title = "elm-pages blog"
|
|
|
|
, body =
|
2021-05-10 23:48:20 +03:00
|
|
|
[ div
|
|
|
|
[ css
|
|
|
|
[ Tw.flex
|
|
|
|
, Tw.flex_col
|
2021-05-10 23:52:14 +03:00
|
|
|
, Tw.pt_8
|
2021-05-11 00:00:52 +03:00
|
|
|
, Tw.px_4
|
|
|
|
, Bp.lg
|
|
|
|
[ Tw.px_8
|
|
|
|
]
|
|
|
|
, Bp.sm
|
|
|
|
[ Tw.py_20
|
|
|
|
, Tw.px_6
|
|
|
|
]
|
2021-05-10 23:48:20 +03:00
|
|
|
]
|
|
|
|
]
|
|
|
|
[ topSection
|
|
|
|
, div
|
|
|
|
[ css
|
|
|
|
[ Tw.pt_8
|
|
|
|
, Tw.flex
|
|
|
|
, Tw.justify_around
|
|
|
|
]
|
|
|
|
]
|
2021-05-12 17:38:09 +03:00
|
|
|
[ showcaseEntries static.data ]
|
2020-05-24 18:52:09 +03:00
|
|
|
]
|
2020-10-25 01:46:01 +03:00
|
|
|
]
|
2020-05-20 16:42:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-05-12 01:27:37 +03:00
|
|
|
head : StaticPayload Data ActionData {} -> 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 =
|
2021-05-24 01:11:46 +03:00
|
|
|
{ url = [ "images", "icon-png.png" ] |> Path.join |> Pages.Url.fromPath
|
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
|
2021-05-10 23:48:20 +03:00
|
|
|
|
|
|
|
|
|
|
|
showcaseEntries : List Showcase.Entry -> Html msg
|
|
|
|
showcaseEntries items =
|
|
|
|
ul
|
|
|
|
[ Attr.attribute "role" "list"
|
|
|
|
, css
|
|
|
|
[ Tw.grid
|
|
|
|
, Tw.grid_cols_2
|
|
|
|
, Tw.gap_x_4
|
|
|
|
, Tw.gap_y_8
|
|
|
|
, Tw.w_full
|
|
|
|
, Tw.max_w_screen_lg
|
|
|
|
|
|
|
|
--, Bp.lg
|
|
|
|
-- [ Tw.grid_cols_4
|
|
|
|
-- ]
|
|
|
|
, Bp.sm
|
|
|
|
[ Tw.grid_cols_3
|
|
|
|
, Tw.gap_x_6
|
|
|
|
]
|
|
|
|
, Bp.xl
|
|
|
|
[ Tw.gap_x_8
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
(items
|
|
|
|
|> List.map showcaseItem
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
showcaseItem : Showcase.Entry -> Html msg
|
|
|
|
showcaseItem item =
|
|
|
|
li
|
|
|
|
[ css
|
|
|
|
[ Tw.relative
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ div
|
|
|
|
[ css
|
|
|
|
[ --Tw.group
|
|
|
|
Tw.block
|
|
|
|
|
|
|
|
--, Tw.w_full
|
|
|
|
, Tw.aspect_w_10
|
|
|
|
, Tw.aspect_h_7
|
|
|
|
, Tw.rounded_lg
|
|
|
|
, Tw.bg_gray_100
|
|
|
|
, Tw.overflow_hidden
|
|
|
|
|
|
|
|
--, Bp.focus-within
|
|
|
|
-- [ Tw.ring_2
|
|
|
|
-- , Tw.ring_offset_2
|
|
|
|
-- , Tw.ring_offset_gray_100
|
|
|
|
-- , Tw.ring_indigo_500
|
|
|
|
-- ]
|
|
|
|
]
|
|
|
|
]
|
2021-11-24 23:54:00 +03:00
|
|
|
[ a
|
|
|
|
[ href item.liveUrl
|
|
|
|
, Attr.target "_blank"
|
|
|
|
, Attr.rel "noopener"
|
|
|
|
]
|
|
|
|
[ img
|
|
|
|
[ Attr.src <| "https://image.thum.io/get/width/800/crop/800/" ++ item.screenshotUrl
|
|
|
|
, Attr.alt ""
|
|
|
|
, Attr.attribute "loading" "lazy"
|
|
|
|
, css
|
|
|
|
[ Tw.object_cover
|
|
|
|
, Tw.pointer_events_none
|
2021-05-10 23:48:20 +03:00
|
|
|
|
2021-11-24 23:54:00 +03:00
|
|
|
--, Bp.group
|
|
|
|
--- hover
|
|
|
|
-- [ Tw.opacity_75
|
|
|
|
-- ]
|
|
|
|
]
|
2021-05-10 23:48:20 +03:00
|
|
|
]
|
2021-11-24 23:54:00 +03:00
|
|
|
[]
|
2021-05-10 23:48:20 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
--, button
|
|
|
|
-- [ Attr.type_ "button"
|
|
|
|
-- , css
|
|
|
|
-- [ Tw.absolute
|
|
|
|
-- , Tw.inset_0
|
|
|
|
-- , Css.focus
|
|
|
|
-- [ Tw.outline_none
|
|
|
|
-- ]
|
|
|
|
-- ]
|
|
|
|
-- ]
|
|
|
|
-- [ span
|
|
|
|
-- [ css
|
|
|
|
-- [ Tw.sr_only
|
|
|
|
-- ]
|
|
|
|
-- ]
|
|
|
|
-- [ text "View details for IMG_4985.HEIC" ]
|
|
|
|
-- ]
|
|
|
|
]
|
|
|
|
, a
|
|
|
|
[ href item.liveUrl
|
|
|
|
, Attr.target "_blank"
|
2021-11-24 23:54:00 +03:00
|
|
|
, Attr.rel "noopener"
|
2021-05-10 23:48:20 +03:00
|
|
|
, css
|
|
|
|
[ Tw.mt_2
|
|
|
|
, Tw.block
|
|
|
|
, Tw.text_sm
|
|
|
|
, Tw.font_medium
|
|
|
|
, Tw.text_gray_900
|
|
|
|
, Tw.truncate
|
|
|
|
|
|
|
|
--, Tw.pointer_events_none
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ text item.displayName ]
|
|
|
|
, a
|
|
|
|
[ href item.authorUrl
|
|
|
|
, Attr.target "_blank"
|
2021-11-24 23:54:00 +03:00
|
|
|
, Attr.rel "noopener"
|
2021-05-10 23:48:20 +03:00
|
|
|
, css
|
|
|
|
[ Tw.block
|
|
|
|
, Tw.text_sm
|
|
|
|
, Tw.font_medium
|
|
|
|
, Tw.text_gray_500
|
|
|
|
|
|
|
|
--, Tw.pointer_events_none
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ text item.authorName ]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
topSection : Html msg
|
|
|
|
topSection =
|
|
|
|
div
|
|
|
|
[ css
|
|
|
|
[]
|
|
|
|
]
|
|
|
|
[ div
|
|
|
|
[ css
|
|
|
|
[ Tw.max_w_2xl
|
|
|
|
, Tw.mx_auto
|
|
|
|
, Tw.text_center
|
|
|
|
, Tw.py_16
|
|
|
|
, Bp.sm
|
|
|
|
[ Tw.py_20
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ h2
|
|
|
|
[ css
|
|
|
|
[ Tw.text_3xl
|
|
|
|
, Tw.font_extrabold
|
|
|
|
, Bp.sm
|
|
|
|
[ Tw.text_4xl
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ span
|
|
|
|
[ css
|
|
|
|
[ Tw.block
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ text "elm-pages Showcase" ]
|
|
|
|
]
|
|
|
|
, p
|
|
|
|
[ css
|
|
|
|
[ Tw.mt_4
|
|
|
|
, Tw.text_lg
|
|
|
|
, Tw.leading_6
|
|
|
|
, Tw.text_gray_500
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ text "Check out some projects from the elm-pages community." ]
|
|
|
|
, a
|
|
|
|
[ Attr.href "https://airtable.com/shrPSenIW2EQqJ083"
|
|
|
|
, Attr.target "_blank"
|
2021-11-24 23:54:00 +03:00
|
|
|
, Attr.rel "noopener"
|
2021-05-10 23:48:20 +03:00
|
|
|
, css
|
|
|
|
[ Tw.mt_8
|
|
|
|
, Tw.w_full
|
|
|
|
, Tw.inline_flex
|
|
|
|
, Tw.items_center
|
|
|
|
, Tw.justify_center
|
|
|
|
, Tw.px_5
|
|
|
|
, Tw.py_3
|
|
|
|
, Tw.border
|
|
|
|
, Tw.border_transparent
|
|
|
|
, Tw.text_white
|
|
|
|
, Tw.font_medium
|
|
|
|
, Tw.rounded_md
|
|
|
|
, Tw.bg_blue_800
|
|
|
|
, Css.hover
|
|
|
|
[ Tw.bg_blue_600
|
|
|
|
]
|
|
|
|
, Bp.sm
|
|
|
|
[ Tw.w_auto
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ text "Submit your site to the showcase" ]
|
|
|
|
]
|
|
|
|
]
|