Skip to content

Commit

Permalink
Adjust code
Browse files Browse the repository at this point in the history
  • Loading branch information
andreytroeglazov committed Oct 17, 2024
1 parent 6b9fc0d commit 2437d73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static/app.css

static/articles
static/paragraph_quotes
static/paragraph_hero_images

# @todo: Fix the creation of duplicates
static/styleGuideImages/imageStyles
Expand Down
18 changes: 10 additions & 8 deletions Web/Element/HeroImage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ import Web.Element.Button

render :: RenderHeroImage -> Html
render record@RenderHeroImage {title, maybeSubtitle, maybeButton, imageUrl} =
titleWrapped
++ subTitleWrapped
++ renderedButton
|> wrapVerticalSpacingBig AlignNone
|> renderImageAndContent (pathTo $ RenderImageStyleAction 1536 466 imageUrl signed)
[ titleWrapped
, subTitleWrapped
, renderedButton
]
|> catMaybes
|> mconcat
|> wrapVerticalSpacingBig AlignNone
|> renderImageAndContent (pathTo $ RenderImageStyleAction 1536 466 imageUrl signed)
where
-- Sign the image URL to prevent tampering.
signed = signImageUrl imageUrl 1536 466
Expand All @@ -21,16 +24,15 @@ render record@RenderHeroImage {title, maybeSubtitle, maybeButton, imageUrl} =
|> wrapHeaderTag 1
|> wrapTextFontWeight FontWeightBold
|> wrapTextResponsiveFontSize TextSizeSm
|> Just

subTitleWrapped = maybeSubtitle
|> fmap (\subtitle -> cs subtitle
|> wrapTextFontWeight FontWeightMedium
|> wrapTextResponsiveFontSize TextSizeXl
)
|> fromMaybe ""

renderedButton = maybeButton |> fmap Web.Element.Button.render |> fromMaybe ""

renderedButton = maybeButton |> fmap Web.Element.Button.render

renderImageAndContent :: Text -> Html -> Html
renderImageAndContent imageUrl items =
Expand Down

0 comments on commit 2437d73

Please sign in to comment.