diff --git a/components/brave_new_tab_ui/components/default/braveToday/customize/FeedCard.tsx b/components/brave_new_tab_ui/components/default/braveToday/customize/FeedCard.tsx index 77ff60a59959..26f41ed4796b 100644 --- a/components/brave_new_tab_ui/components/default/braveToday/customize/FeedCard.tsx +++ b/components/brave_new_tab_ui/components/default/braveToday/customize/FeedCard.tsx @@ -64,7 +64,7 @@ export default function FeedCard (props: { const backgroundColor = publisher.backgroundColor || getCardColor(publisher.feedSource?.url || publisher.publisherId) const { url: coverUrl, elementRef } = useLazyUnpaddedImageUrl(publisher.coverUrl?.url, { - rootElement: document.getElementById('brave-news-container')!, + rootElement: document.getElementById('brave-news-configure'), rootMargin: '0px 0px 200px 0px', useCache: true }) diff --git a/components/brave_new_tab_ui/components/default/braveToday/customize/SourcesListEntry.tsx b/components/brave_new_tab_ui/components/default/braveToday/customize/SourcesListEntry.tsx index eeb708a07a66..b95660a863da 100644 --- a/components/brave_new_tab_ui/components/default/braveToday/customize/SourcesListEntry.tsx +++ b/components/brave_new_tab_ui/components/default/braveToday/customize/SourcesListEntry.tsx @@ -8,7 +8,7 @@ import styled from 'styled-components' import { getLocale } from '$web-common/locale' import Flex from '../../../Flex' import { useChannelSubscribed, usePublisher, usePublisherFollowed } from './Context' -import { useUnpaddedImageUrl } from '../useUnpaddedImageUrl' +import { useLazyUnpaddedImageUrl } from '../useUnpaddedImageUrl' interface Props { publisherId: string @@ -60,9 +60,13 @@ const ChannelNameText = styled.span` ` function FavIcon (props: { src?: string }) { - const url = useUnpaddedImageUrl(props.src, undefined, /* useCache= */true) + const { url, elementRef } = useLazyUnpaddedImageUrl(props.src, { + rootElement: document.getElementById('brave-news-configure'), + rootMargin: '0px 0px 100px 0px', + useCache: true + }) const [error, setError] = React.useState(false) - return + return {url && !error && setError(true)} />} } diff --git a/components/brave_new_tab_ui/components/default/braveToday/useUnpaddedImageUrl.ts b/components/brave_new_tab_ui/components/default/braveToday/useUnpaddedImageUrl.ts index 92b2150bdd1f..8b90f089e687 100644 --- a/components/brave_new_tab_ui/components/default/braveToday/useUnpaddedImageUrl.ts +++ b/components/brave_new_tab_ui/components/default/braveToday/useUnpaddedImageUrl.ts @@ -7,7 +7,7 @@ import * as React from 'react' import getBraveNewsController from '../../../api/brave_news' interface Options { - rootElement?: HTMLElement + rootElement?: HTMLElement | null rootMargin?: string threshold?: number