website/frontend/src/Pages/Blog/Seedoils.elm

196 lines
4.4 KiB
Elm
Raw Normal View History

2024-12-16 00:12:23 -06:00
module Pages.Blog.Seedoils exposing (Model, Msg, page)
2024-12-09 19:53:09 -06:00
import Config.Data.Identity exposing (pageNames)
2024-12-15 02:31:26 -06:00
import Config.Helpers.CardFormat
exposing
( cardContentSpacing
, cardFormatter
, cardMaker
2024-12-16 00:12:23 -06:00
, cardSubTitleMaker
2024-12-15 02:31:26 -06:00
, cardTitleMaker
, desktopCardMaker
, desktopImageBoxSize
, desktopImageSize
, fieldSpacer
, mobileCardMaker
, mobileImageBoxSize
, mobileImageSize
, topLevelBox
)
2024-12-16 00:12:23 -06:00
import Config.Helpers.Format exposing (..)
import Config.Helpers.Header
exposing
( Header
, headerMaker
)
import Config.Helpers.Markdown exposing (..)
2024-12-17 02:17:06 -06:00
import Config.Helpers.References exposing (makeReference)
2024-12-11 03:48:49 -06:00
import Config.Helpers.Response
2024-12-09 19:53:09 -06:00
exposing
2024-12-09 20:30:04 -06:00
( pageList
2024-12-09 19:53:09 -06:00
, topLevelContainer
)
2024-12-16 00:12:23 -06:00
import Config.Helpers.StrengthBar
exposing
( barMaker
, barPadding
)
import Config.Helpers.ToolTip exposing (..)
2024-12-09 19:53:09 -06:00
import Config.Helpers.Viewport exposing (resetViewport)
2024-12-16 00:12:23 -06:00
import Config.Pages.Blog.Records.SeedOils exposing (articleSeedOils)
2024-12-17 02:17:06 -06:00
import Config.Pages.Blog.Types exposing (BlogArticle)
2024-12-16 00:12:23 -06:00
import Config.Pages.Contact.Types exposing (..)
import Config.Pages.Interviews.Types exposing (..)
import Config.Pages.Products.Types exposing (..)
import Config.Style.Colour exposing (colourTheme)
import Config.Style.Transitions
2024-12-15 03:01:13 -06:00
exposing
2024-12-16 00:12:23 -06:00
( hoverFontDarkOrange
, transitionStyleFast
, transitionStyleSlow
2024-12-15 03:01:13 -06:00
)
import Effect exposing (Effect)
2024-12-09 19:53:09 -06:00
import Element as E exposing (..)
2024-12-16 00:12:23 -06:00
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html
import Html.Attributes as H exposing (style)
import Layouts
import Page exposing (Page)
import Route exposing (Route)
import Shared exposing (..)
import View exposing (View)
2024-12-08 21:35:48 -06:00
page : Shared.Model -> Route () -> Page Model Msg
page shared route =
Page.new
{ init = init
, update = update
, subscriptions = subscriptions
2024-12-08 21:35:48 -06:00
, view = view shared
}
2024-12-01 02:56:13 -06:00
|> Page.withLayout toLayout
toLayout : Model -> Layouts.Layout Msg
toLayout model =
2024-12-06 22:03:24 -06:00
Layouts.Navbar {}
-- INIT
type alias Model =
{}
init : () -> ( Model, Effect Msg )
init () =
( {}
2024-12-16 00:12:23 -06:00
, Effect.none
)
-- UPDATE
type Msg
= NoOp
update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
case msg of
NoOp ->
( model
, Effect.none
)
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- VIEW
2024-12-08 21:35:48 -06:00
view : Shared.Model -> Model -> View Msg
view shared model =
2024-12-17 02:17:06 -06:00
{ title = pageNames.pageHyperBlog ++ " (seedOils)"
2024-12-01 02:56:13 -06:00
, attributes = []
2024-12-16 00:12:23 -06:00
, element = articleContainer shared.device
2024-12-01 02:56:13 -06:00
}
2024-12-08 21:35:48 -06:00
2024-12-16 00:12:23 -06:00
articleContainer : Device -> Element msg
articleContainer device =
topLevelContainer (articleList device)
2024-12-08 21:35:48 -06:00
2024-12-16 00:12:23 -06:00
articleList : Device -> Element msg
articleList device =
2024-12-17 02:17:06 -06:00
column
(case ( device.class, device.orientation ) of
_ ->
pageList
)
<|
2024-12-08 21:35:48 -06:00
List.concat
2024-12-17 02:17:06 -06:00
[ (case ( device.class, device.orientation ) of
2024-12-08 21:35:48 -06:00
_ ->
2024-12-17 02:17:06 -06:00
List.map articleMaker
)
[ articleSeedOils ]
]
2024-12-15 03:01:13 -06:00
2024-12-17 02:17:06 -06:00
articleMaker : BlogArticle -> Element msg
articleMaker article =
2024-12-16 00:12:23 -06:00
column
topLevelBox
[ cardMaker
[ cardTitleMaker (String.toUpper articleSeedOils.articleName)
, cardFormatter
[ cardContentSpacing
[ column
fieldSpacer
[ cardSubTitleMaker
[ articleImage articleSeedOils.articleImage
, renderDeviceMarkdown articleSeedOils.articleBody
2024-12-17 02:17:06 -06:00
, articleReferences article
2024-12-16 00:12:23 -06:00
]
]
]
]
]
]
2024-12-17 02:17:06 -06:00
articleReferences : BlogArticle -> Element msg
articleReferences article =
column
[ width fill
, height fill
, paddingEach
{ top = 10
, right = 0
, bottom = 0
, left = 0
}
]
[ column [ width fill, F.size 15, spacing 10 ] <|
List.map2 (\x y -> makeReference x y)
article.articleReferences
(List.range 1 (List.length article.articleReferences))
]