diff --git a/.gitignore b/.gitignore index c1b4e89..0d39432 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Web/Element/HeroImage.hs b/Web/Element/HeroImage.hs index c22c295..ae3328a 100644 --- a/Web/Element/HeroImage.hs +++ b/Web/Element/HeroImage.hs @@ -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 @@ -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 =