From b4f1788acfb97979460a53f838506e40d5d7f50d Mon Sep 17 00:00:00 2001 From: Borghild Selle <104756130+BorghildSelle@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:41:42 +0100 Subject: [PATCH] :art: updates to newsroom #2631 (#2635) * :art: updates to newsroom * :bug: correct url --- web/next.config.js | 4 ++ .../newsroom/NewsSections/NewsHeadliner.tsx | 40 ++++++++++++------ .../newsroom/NewsSections/NewsItem.tsx | 42 +++++++++++++------ web/types/algoliaIndexPage.ts | 1 + 4 files changed, 63 insertions(+), 24 deletions(-) diff --git a/web/next.config.js b/web/next.config.js index e957be184..846cb53b8 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -86,6 +86,10 @@ export default withBundle({ source: '/legacy/:slug*', destination: `${archiveServerHostname}/:slug*`, }, + { + source: 'https://envisstoragedev.blob.core.windows.net/:slug*', + destination: `${archiveServerHostname}/:slug*`, + }, ].filter((e) => e) }, async headers() { diff --git a/web/templates/newsroom/NewsSections/NewsHeadliner.tsx b/web/templates/newsroom/NewsSections/NewsHeadliner.tsx index b740b26dc..fe0f18eba 100644 --- a/web/templates/newsroom/NewsSections/NewsHeadliner.tsx +++ b/web/templates/newsroom/NewsSections/NewsHeadliner.tsx @@ -1,5 +1,6 @@ import { FormattedDate } from '@components/FormattedDateTime' import { forwardRef, HTMLAttributes } from 'react' +import Img from 'next/image' import { BaseLink } from '@core/Link' import { Typography } from '@core/Typography' import Image, { Ratios } from '../../../pageComponents/shared/SanityImage' @@ -17,23 +18,38 @@ const NewsHeadliner = forwardRef(function New { data, fallbackImage, className = '', ...rest }, ref, ) { - const { slug, title, ingress, publishDateTime, heroImage } = data + const { slug, title, ingress, publishDateTime, heroImage, thumbnailUrl } = data return (
- {(heroImage?.image?.asset || fallbackImage) && ( + {(heroImage?.image?.asset || fallbackImage || thumbnailUrl) && (
- + {thumbnailUrl ? ( +
+ +
+ ) : ( + (heroImage?.image?.asset || fallbackImage) && ( + + ) + )}
)} {publishDateTime && ( diff --git a/web/templates/newsroom/NewsSections/NewsItem.tsx b/web/templates/newsroom/NewsSections/NewsItem.tsx index 104d9b0d5..9a87f1c64 100644 --- a/web/templates/newsroom/NewsSections/NewsItem.tsx +++ b/web/templates/newsroom/NewsSections/NewsItem.tsx @@ -1,5 +1,6 @@ import { FormattedDate } from '@components/FormattedDateTime' import { forwardRef, HTMLAttributes } from 'react' +import Img from 'next/image' import { BaseLink } from '@core/Link' import { Typography } from '@core/Typography' import Image, { Ratios } from '../../../pageComponents/shared/SanityImage' @@ -17,12 +18,12 @@ const NewsItem = forwardRef(function NewsItem( { data, fallbackImage, className = '', ...rest }, ref, ) { - const { slug, title, publishDateTime, heroImage } = data || {} + const { slug, title, publishDateTime, heroImage, thumbnailUrl } = data || {} return (
-
+
{publishDateTime && ( )} @@ -33,16 +34,33 @@ const NewsItem = forwardRef(function NewsItem( )}
- {(heroImage?.image?.asset || fallbackImage) && ( - + {(heroImage?.image?.asset || fallbackImage || thumbnailUrl) && ( + <> + {thumbnailUrl ? ( +
+ +
+ ) : ( + (heroImage?.image?.asset || fallbackImage) && ( + + ) + )} + )}
diff --git a/web/types/algoliaIndexPage.ts b/web/types/algoliaIndexPage.ts index eb2224990..5b8cac3a0 100644 --- a/web/types/algoliaIndexPage.ts +++ b/web/types/algoliaIndexPage.ts @@ -33,6 +33,7 @@ export type NewsRoomNewsItem = { publishDateTime?: string firstPublishedAt?: string heroImage: ImageWithCaptionData + thumbnailUrl?: string ingress?: string }