Skip to content

Commit 47c913d

Browse files
authored
Merge pull request #1305 from prezly/feature/dev-20578-we-are-showing-a-stories-empty-state-when-there-are-no
[DEV-20578] Fix - Hide "Latest stories" and empty state in hubs
2 parents 9c17d4f + 45fd94e commit 47c913d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/modules/InfiniteHubStories/InfiniteHubStories.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ export function InfiniteHubStories({
9595
);
9696
})}
9797
</div>
98-
<PageTitle
99-
className={styles.title}
100-
title={formatMessage(translations.homepage.latestStories)}
101-
/>
98+
{data.length > 0 && (
99+
<PageTitle
100+
className={styles.title}
101+
title={formatMessage(translations.homepage.latestStories)}
102+
/>
103+
)}
102104
<StoriesList
103105
fullWidthFeaturedStory={false}
104106
isCategoryList
@@ -109,6 +111,7 @@ export function InfiniteHubStories({
109111
showSubtitle={showSubtitle}
110112
stories={data}
111113
storyCardVariant={storyCardVariant}
114+
withEmptyState={false}
112115
/>
113116

114117
{!done && (

src/modules/InfiniteStories/StoriesList.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type Props = {
3030
showSubtitle: boolean;
3131
stories: ListStory[];
3232
storyCardVariant: ThemeSettings['story_card_variant'];
33+
withEmptyState?: boolean;
3334
};
3435

3536
export function StoriesList({
@@ -44,6 +45,7 @@ export function StoriesList({
4445
showSubtitle,
4546
stories,
4647
storyCardVariant,
48+
withEmptyState = true,
4749
}: Props) {
4850
const locale = useLocale();
4951
const hasCategories = categories.length > 0;
@@ -64,7 +66,7 @@ export function StoriesList({
6466

6567
const getStoryCardSize = useStoryCardLayout(isCategoryList);
6668

67-
if (!highlightedStories.length && !restStories.length) {
69+
if (withEmptyState && !highlightedStories.length && !restStories.length) {
6870
return (
6971
<div className={styles.noStories}>
7072
<Illustration />

0 commit comments

Comments
 (0)