Skip to content

Commit

Permalink
Merge pull request #1118 from prezly/feature/dev-12654-buy-translatio…
Browse files Browse the repository at this point in the history
…ns-for-new-strings-in-bea

[DEV-12654] Use translations for "All stories" and "Recent stories"
  • Loading branch information
kudlajz authored Mar 22, 2024
2 parents 2e8965e + ddf23b9 commit 26e4d06
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 40 deletions.
16 changes: 12 additions & 4 deletions modules/InfiniteStories/ui/CategoriesFilters/CategoriesFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Category } from '@prezly/sdk/dist/types';
import type { Locale } from '@prezly/theme-kit-nextjs';
import { FormattedMessage, type Locale, translations, useIntl } from '@prezly/theme-kit-nextjs';
import classNames from 'classnames';
import Link from 'next/link';
import type { ReactNode } from 'react';

import { PageTitle } from '@/components/PageTitle';

Expand All @@ -15,11 +16,18 @@ interface Props {
}

export function CategoriesFilters({ activeCategory, categories, className, locale }: Props) {
const { formatMessage } = useIntl();

return (
<div className={className}>
<PageTitle className={styles.title} title="Latest stories" />
<PageTitle
className={styles.title}
title={formatMessage(translations.homepage.latestStories)}
/>
<div className={styles.filters}>
<Filter isActive={activeCategory === undefined}>All stories</Filter>
<Filter isActive={activeCategory === undefined}>
<FormattedMessage locale={locale} for={translations.homepage.allStories} />
</Filter>
{categories.map(({ id, display_name, i18n }) => (
<Filter categoryId={id} isActive={activeCategory?.id === id} key={id}>
{i18n[locale]?.name || display_name}
Expand All @@ -32,7 +40,7 @@ export function CategoriesFilters({ activeCategory, categories, className, local

export function Filter(props: {
categoryId?: Category['id'];
children: string;
children: ReactNode;
isActive: boolean;
}) {
const { categoryId, children, isActive } = props;
Expand Down
70 changes: 35 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@prezly/content-renderer-react-js": "0.34.4",
"@prezly/sdk": "20.3.0",
"@prezly/story-content-format": "0.64.0",
"@prezly/theme-kit-nextjs": "9.2.2",
"@prezly/theme-kit-nextjs": "9.3.0",
"@prezly/uploadcare": "2.4.3",
"@prezly/uploadcare-image": "0.3.2",
"@react-hookz/web": "14.7.1",
Expand Down

0 comments on commit 26e4d06

Please sign in to comment.