|
2 | 2 |
|
3 | 3 | import type { Newsroom } from '@prezly/sdk'; |
4 | 4 | import { Category } from '@prezly/sdk'; |
5 | | -import { translations } from '@prezly/theme-kit-nextjs'; |
| 5 | +import { translations, useIntl } from '@prezly/theme-kit-nextjs'; |
6 | 6 | import classNames from 'classnames'; |
7 | 7 | import { useMemo } from 'react'; |
8 | 8 |
|
9 | 9 | import { FormattedMessage, useLocale } from '@/adapters/client'; |
| 10 | +import { PageTitle } from '@/components/PageTitle'; |
10 | 11 | import { StaggeredLayout } from '@/components/StaggeredLayout'; |
11 | 12 | import { HighlightedStoryCard, StoryCard } from '@/components/StoryCards'; |
12 | 13 | import type { ThemeSettings } from '@/theme-settings'; |
@@ -52,7 +53,9 @@ export function StoriesList({ |
52 | 53 | withEmptyState = true, |
53 | 54 | }: Props) { |
54 | 55 | const locale = useLocale(); |
| 56 | + const { formatMessage } = useIntl(); |
55 | 57 | const hasCategories = categories.length > 0; |
| 58 | + const hasStories = stories.length > 0; |
56 | 59 |
|
57 | 60 | const [highlightedStories, restStories] = useMemo(() => { |
58 | 61 | if (isCategoryList) { |
@@ -110,13 +113,22 @@ export function StoriesList({ |
110 | 113 | })} |
111 | 114 | </div> |
112 | 115 | )} |
113 | | - <CategoriesFilters |
114 | | - activeCategory={category} |
115 | | - categories={categories} |
116 | | - className={styles.filtersContainer} |
117 | | - hasStories={stories.length > 0} |
118 | | - locale={locale} |
| 116 | + <PageTitle |
| 117 | + className={classNames(styles.pageTitle, { |
| 118 | + // We want to hide the page title for regular users, but keep it |
| 119 | + // for the screen readers. |
| 120 | + [styles.aria]: isCategoryList ? !hasStories : !hasCategories, |
| 121 | + })} |
| 122 | + title={formatMessage(translations.homepage.latestStories)} |
119 | 123 | /> |
| 124 | + {hasCategories && ( |
| 125 | + <CategoriesFilters |
| 126 | + activeCategory={category} |
| 127 | + categories={categories} |
| 128 | + className={styles.filters} |
| 129 | + locale={locale} |
| 130 | + /> |
| 131 | + )} |
120 | 132 | {restStories.length > 0 && layout === 'grid' && ( |
121 | 133 | <div |
122 | 134 | className={classNames(styles.storiesContainer, { |
|
0 commit comments