feat: refactoring and tidying up

This commit is contained in:
Nick 2024-12-18 20:11:04 -06:00
parent 62be86f2f9
commit 2295c85fca
112 changed files with 862 additions and 1698 deletions

View file

@ -1,6 +1,7 @@
module Pages.Blog exposing (Model, Msg, page)
import Config.Data.Identity exposing (pageNames)
import Config.Helpers.Articles.Article exposing (extractFirstWords)
import Config.Helpers.CardFormat
exposing
( cardContentSpacing
@ -24,10 +25,17 @@ import Config.Helpers.Converters
)
import Config.Helpers.Format
exposing
( paragraphFontSize
( headerFontSizeSmall
, paragraphFontSize
, paragraphSpacing
)
import Config.Helpers.Header exposing (..)
import Config.Helpers.Headers.Header exposing (headerMaker)
import Config.Helpers.Headers.Types exposing (Header)
import Config.Helpers.Markdown
exposing
( renderDeviceMarkdown
, renderDeviceMarkdownNoToc
)
import Config.Helpers.Response
exposing
( pageList
@ -263,7 +271,7 @@ articleMaker article =
, right = 0
}
]
[ text article.articleDescription ]
[ renderDeviceMarkdownNoToc (extractFirstWords article.articleBody) ]
]
]
)
@ -273,16 +281,16 @@ articleMaker article =
infoRow : String -> String -> Element msg
infoRow label value =
row [ width fill ]
[ el [ width <| px 85 ] <|
paragraph
[ el [ width <| px 88 ] <|
el
[ F.color colourTheme.textLightOrange
, paragraphSpacing
, paragraphFontSize
, F.bold
, F.size 18
, headerFontSizeSmall
, E.width fill
]
[ text label ]
<|
text label
, el [ width fill ] <|
paragraph
[ F.color colourTheme.textLightGrey
@ -296,8 +304,18 @@ infoRow label value =
articleRows : BlogArticle -> List (Element msg)
articleRows article =
[ infoRow "Author:" article.articleAuthor
, infoRow "Published:" article.articlePublished
let
referenceCount =
List.length article.articleReferences
in
[ infoRow "Published:" article.articlePublished
, infoRow "Author:" article.articleAuthor
, infoRow "Duration:" (String.fromInt (wordCount article.articleBody // 225) ++ " minutes")
, infoRow "Words:" (String.fromInt (wordCount article.articleBody))
]
++ (if referenceCount > 2 then
[ infoRow "Sources:" (String.fromInt referenceCount) ]
else
[]
)