feat: so very close

This commit is contained in:
Nick 2024-12-28 18:42:47 -06:00
parent 131dbfe8a3
commit f9b8f59df9
30 changed files with 1500 additions and 1272 deletions

View file

@ -2,6 +2,7 @@ module Config.Helpers.Articles.Article exposing (..)
import Config.Data.Identity exposing (pageNames)
import Config.Helpers.Articles.Types exposing (References)
import Config.Helpers.Cards.Inner.Helpers exposing (detailFormat)
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
import Config.Helpers.Cards.Outer.Types as C
import Config.Helpers.Format exposing (..)
@ -45,34 +46,44 @@ import Shared exposing (..)
import View exposing (View)
contentList : BlogArticle -> List (Element msg)
contentList article =
[ articleImage article.articleImage
, renderDeviceMarkdown article.articleBody
contentList : BlogArticle -> List (Element msg) -> List (Element msg)
contentList article extraElements =
[ case article.articleImage of
"" ->
none
_ ->
articleImage article.articleImage
, case article.hasTableOfContents of
True ->
renderDeviceMarkdown article.articleBody
False ->
renderDeviceMarkdownNoToc article.articleBody
, case article.hasReferences of
True ->
articleReferences article
False ->
none
, detailFormat column extraElements
]
articleReferences : BlogArticle -> Element msg
articleReferences article =
el
[ width fill
, height fill
]
<|
column [ width fill, F.size 15, spacing 10 ] <|
List.map2 (\x y -> makeReference x y)
article.articleReferences
(List.range 1 (List.length article.articleReferences))
column [ width fill, F.size 15, spacing 10 ] <|
List.map2 (\x y -> makeReference x y)
article.articleReferences
(List.range 1 (List.length article.articleReferences))
makeReference : References -> Int -> Element msg
makeReference references index =
let
comma =
", "
in
el
[ F.regular
, F.alignLeft
@ -86,9 +97,9 @@ makeReference references index =
, transitionStyleFast
]
{ url = references.link, label = text (String.fromInt index ++ ". ") }
, text (references.author ++ ", ")
, text (references.title ++ ", ")
, text (references.journal ++ ", ")
, text (references.author ++ comma)
, text (references.title ++ comma)
, text (references.journal ++ comma)
, text references.year
]