diff --git a/web/pageComponents/shared/SanityImage.tsx b/web/pageComponents/shared/SanityImage.tsx index dcc283f6c..6be36a9b0 100644 --- a/web/pageComponents/shared/SanityImage.tsx +++ b/web/pageComponents/shared/SanityImage.tsx @@ -26,6 +26,7 @@ const DEFAULT_MAX_WIDTH = 1440 const Image = ({ image, aspectRatio, sizes = DEFAULT_SIZES, maxWidth = DEFAULT_MAX_WIDTH, fill, ...rest }: Props) => { const imageProps = useSanityLoader(image, maxWidth, aspectRatio) + console.log('image iamge', image) if (!image?.asset) return <> const { width, height, src } = imageProps diff --git a/web/templates/newsroom/NewsSections/NewsHeadliner.tsx b/web/templates/newsroom/NewsSections/NewsHeadliner.tsx index d132905b7..67c3eab94 100644 --- a/web/templates/newsroom/NewsSections/NewsHeadliner.tsx +++ b/web/templates/newsroom/NewsSections/NewsHeadliner.tsx @@ -21,10 +21,11 @@ const NewsHeadliner = forwardRef(function New return (
- {(heroImage ?? fallbackImage) && ( + {(heroImage?.image?.asset || fallbackImage) && (
(function NewsItem( ) { const { slug, pageTitle, publishDateTime, heroImage } = data || {} + console.log('heroImage', heroImage) return (
@@ -33,9 +34,10 @@ const NewsItem = forwardRef(function NewsItem( )}
- {(heroImage ?? fallbackImage) && ( + {(heroImage?.image?.asset || fallbackImage) && ( (function News return } + console.log('fallbackImages', fallbackImages) + return (
{items.map((hit, index) => { @@ -29,7 +31,7 @@ const NewsSections = forwardRef(function News key={hit.objectID} //@ts-ignore: TODO Hit into a NewsRoomNewsItem data={hit} - {...(!hit?.heroImage && + {...(!hit?.heroImage?.image?.asset && fallbackImages && { fallbackImage: fallbackImages[Math.floor(Math.random() * fallbackImages?.length)], })} @@ -39,7 +41,7 @@ const NewsSections = forwardRef(function News key={hit.objectID} //@ts-ignore: TODO Hit into a NewsRoomNewsItem data={hit} - {...(!hit?.heroImage && + {...(!hit?.heroImage?.image?.asset && fallbackImages && { fallbackImage: fallbackImages[Math.floor(Math.random() * fallbackImages?.length)], })}