diff --git a/components/ContentRenderer/components/Attachment/DownloadLink.tsx b/components/ContentRenderer/components/Attachment/DownloadLink.tsx index 0159480b0..c30264a1c 100644 --- a/components/ContentRenderer/components/Attachment/DownloadLink.tsx +++ b/components/ContentRenderer/components/Attachment/DownloadLink.tsx @@ -1,7 +1,7 @@ import { translations } from '@prezly/theme-kit-nextjs'; import classNames from 'classnames'; -import { FormattedMessage } from '@/adapters/client'; +import { FormattedMessage, useLocale } from '@/adapters/client'; import { IconDownload } from '@/icons'; import styles from './DownloadLink.module.scss'; @@ -11,9 +11,11 @@ interface Props { } export function DownloadLink({ className }: Props) { + const locale = useLocale(); + return (
- +
); diff --git a/components/StoryLinks/StoryShareUrl.tsx b/components/StoryLinks/StoryShareUrl.tsx index fb96331ff..2f9dbf842 100644 --- a/components/StoryLinks/StoryShareUrl.tsx +++ b/components/StoryLinks/StoryShareUrl.tsx @@ -5,7 +5,7 @@ import { translations } from '@prezly/theme-kit-nextjs'; import classNames from 'classnames'; import { Fragment, useState } from 'react'; -import { FormattedMessage, useIntl } from '@/adapters/client'; +import { FormattedMessage, useIntl, useLocale } from '@/adapters/client'; import { Button } from '@/components/Button'; import { IconLink } from '@/icons'; @@ -19,6 +19,7 @@ interface Props { const TOOLTIP_HIDE_DELAY = 3000; // 3 seconds export function StoryShareUrl({ url, buttonClassName }: Props) { + const locale = useLocale(); const [isTooltipShown, setIsTooltipShown] = useState(false); const { formatMessage } = useIntl(); @@ -51,7 +52,7 @@ export function StoryShareUrl({ url, buttonClassName }: Props) { >
- +
diff --git a/modules/Contacts/ui/Contacts.tsx b/modules/Contacts/ui/Contacts.tsx index 95d3466a0..c7434e2e9 100644 --- a/modules/Contacts/ui/Contacts.tsx +++ b/modules/Contacts/ui/Contacts.tsx @@ -5,7 +5,7 @@ import { translations } from '@prezly/theme-kit-nextjs'; import { UploadcareImage } from '@prezly/uploadcare-image'; import classNames from 'classnames'; -import { FormattedMessage } from '@/adapters/client'; +import { FormattedMessage, useLocale } from '@/adapters/client'; import { ContactCard } from '@/components/ContactCard'; import { useDevice } from '@/hooks'; @@ -19,6 +19,7 @@ interface Props { export function Contacts({ contacts }: Props) { const device = useDevice(); + const locale = useLocale(); const numberOfColumns = getNumberOfColumns(contacts.length); const isCompactCard = numberOfColumns === 3 && !device.isTablet; @@ -26,7 +27,7 @@ export function Contacts({ contacts }: Props) { return (

- +

{({ onAccept, onReject }) => ( @@ -23,7 +25,10 @@ export function CookieConsentBar({ children }: Props) {

- +

{children ? (

@@ -44,17 +50,26 @@ export function CookieConsentBar({ children }: Props) { onClick={onReject} variation="secondary" > - +

- +

diff --git a/modules/Header/Categories.tsx b/modules/Header/Categories.tsx index 1ae23e4b3..89d227856 100644 --- a/modules/Header/Categories.tsx +++ b/modules/Header/Categories.tsx @@ -1,4 +1,5 @@ import type { TranslatedCategory } from '@prezly/sdk'; +import type { Locale } from '@prezly/theme-kit-nextjs'; import { CategoriesNav } from './ui'; @@ -6,15 +7,17 @@ import styles from './ui/Header.module.scss'; interface Props { categories: TranslatedCategory[]; + localeCode: Locale.Code; } -export async function Categories({ categories }: Props) { +export async function Categories({ categories, localeCode }: Props) { if (categories.length === 0) { return null; } return ( - + ); diff --git a/modules/Header/ui/CategoriesNav/CategoriesNav.tsx b/modules/Header/ui/CategoriesNav/CategoriesNav.tsx index 210687531..1f4247c2c 100644 --- a/modules/Header/ui/CategoriesNav/CategoriesNav.tsx +++ b/modules/Header/ui/CategoriesNav/CategoriesNav.tsx @@ -1,4 +1,5 @@ import type { TranslatedCategory } from '@prezly/sdk'; +import type { Locale } from '@prezly/theme-kit-nextjs'; import { translations } from '@prezly/theme-kit-nextjs'; import classNames from 'classnames'; @@ -12,6 +13,7 @@ import styles from './CategoriesNav.module.scss'; export function CategoriesNav({ categories, + localeCode, buttonClassName, navigationItemClassName, navigationButtonClassName, @@ -41,7 +43,9 @@ export function CategoriesNav({ })} > } + label={ + + } buttonClassName={buttonClassName} withMobileDisplay > @@ -57,6 +61,7 @@ export function CategoriesNav({ export namespace CategoriesNav { export interface Props { categories: TranslatedCategory[]; + localeCode: Locale.Code; buttonClassName?: string; navigationItemClassName?: string; navigationButtonClassName?: string; diff --git a/modules/Header/ui/Header.tsx b/modules/Header/ui/Header.tsx index 28f038eaa..f58a30d56 100644 --- a/modules/Header/ui/Header.tsx +++ b/modules/Header/ui/Header.tsx @@ -48,7 +48,7 @@ export function Header({ displayedLanguages, children /* hasError */, }: Props) { - const { formatMessage } = useIntl(); + const { locale, formatMessage } = useIntl(); const { isMobile } = useDevice(); const [isMenuOpen, setIsMenuOpen] = useState(false); @@ -183,6 +183,7 @@ export function Header({ className={styles.navigationButton} > diff --git a/modules/Header/ui/SearchWidget/components/CategoriesList.tsx b/modules/Header/ui/SearchWidget/components/CategoriesList.tsx index 7583de48a..546a7a099 100644 --- a/modules/Header/ui/SearchWidget/components/CategoriesList.tsx +++ b/modules/Header/ui/SearchWidget/components/CategoriesList.tsx @@ -2,7 +2,7 @@ import type { TranslatedCategory } from '@prezly/sdk'; import { translations } from '@prezly/theme-kit-nextjs'; import { useState } from 'react'; -import { FormattedMessage } from '@/adapters/client'; +import { FormattedMessage, useLocale } from '@/adapters/client'; import { Button } from '@/components/Button'; import { Link } from '@/components/Link'; import { onPlainLeftClick } from '@/utils'; @@ -18,6 +18,7 @@ interface Props { } export function CategoriesList({ categories, onClose }: Props) { + const locale = useLocale(); const [showAllCategories, setShowAllCategories] = useState(false); const displayedCategories = showAllCategories @@ -31,7 +32,7 @@ export function CategoriesList({ categories, onClose }: Props) { return ( <>

- +

    @@ -58,9 +59,9 @@ export function CategoriesList({ categories, onClose }: Props) { className={mainStyles.link} > {showAllCategories ? ( - + ) : ( - + )} )} diff --git a/modules/Header/ui/SearchWidget/components/SearchBar.tsx b/modules/Header/ui/SearchWidget/components/SearchBar.tsx index 0d7b55a5a..5bd612de0 100644 --- a/modules/Header/ui/SearchWidget/components/SearchBar.tsx +++ b/modules/Header/ui/SearchWidget/components/SearchBar.tsx @@ -24,7 +24,12 @@ export const SearchBar = connectSearchBox(({ currentRefinement, refine }: Props) >
    } + label={ + + } type="search" name="query" value={currentRefinement} @@ -34,12 +39,12 @@ export const SearchBar = connectSearchBox(({ currentRefinement, refine }: Props) /> {!currentRefinement.length && ( - + )}
    ); diff --git a/modules/Header/ui/SearchWidget/components/SearchResults.tsx b/modules/Header/ui/SearchWidget/components/SearchResults.tsx index dc76ace13..259e3bd2e 100644 --- a/modules/Header/ui/SearchWidget/components/SearchResults.tsx +++ b/modules/Header/ui/SearchWidget/components/SearchResults.tsx @@ -35,9 +35,9 @@ export function SearchResults({ searchResults, query, isSearchPage, onClose }: P <>

    {totalResults ? ( - + ) : ( - + )}

    @@ -50,7 +50,10 @@ export function SearchResults({ searchResults, query, isSearchPage, onClose }: P className={styles.link} forceRefresh={isSearchPage} > - + )} diff --git a/modules/InfiniteStories/InfiniteStories.tsx b/modules/InfiniteStories/InfiniteStories.tsx index 73dc40298..df09d1555 100644 --- a/modules/InfiniteStories/InfiniteStories.tsx +++ b/modules/InfiniteStories/InfiniteStories.tsx @@ -67,9 +67,9 @@ export function InfiniteStories({ className={styles.loadMore} > {loading ? ( - + ) : ( - + )} )} diff --git a/modules/InfiniteStories/StoriesList.tsx b/modules/InfiniteStories/StoriesList.tsx index c6f19ea0a..00857f141 100644 --- a/modules/InfiniteStories/StoriesList.tsx +++ b/modules/InfiniteStories/StoriesList.tsx @@ -3,7 +3,7 @@ import { translations } from '@prezly/theme-kit-nextjs'; import { useMemo } from 'react'; -import { FormattedMessage } from '@/adapters/client'; +import { FormattedMessage, useLocale } from '@/adapters/client'; import { HighlightedStoryCard, StoryCard } from '@/components/StoryCards'; import type { ListStory } from 'types'; @@ -20,6 +20,8 @@ type Props = { }; export function StoriesList({ newsoomName, stories, isCategoryList = false }: Props) { + const locale = useLocale(); + const [highlightedStories, restStories] = useMemo(() => { if (isCategoryList) { return [[], stories]; @@ -40,12 +42,13 @@ export function StoriesList({ newsoomName, stories, isCategoryList = false }: Pr

    - +

); diff --git a/modules/Search/components/Facet.tsx b/modules/Search/components/Facet.tsx index 25f60b58e..801ff7cd7 100644 --- a/modules/Search/components/Facet.tsx +++ b/modules/Search/components/Facet.tsx @@ -5,7 +5,7 @@ import { useCallback, useMemo, useState } from 'react'; import type { RefinementListExposed, RefinementListProvided } from 'react-instantsearch-core'; import { connectRefinementList } from 'react-instantsearch-dom'; -import { FormattedDate, FormattedMessage } from '@/adapters/client'; +import { FormattedDate, FormattedMessage, useLocale } from '@/adapters/client'; import { Button } from '@/components/Button'; import { Dropdown } from '@/components/Dropdown'; @@ -17,6 +17,7 @@ const DEFAULT_FACETS_LIMIT = 7; export const Facet = connectRefinementList( ({ attribute, items, refine }: RefinementListProvided & RefinementListExposed) => { + const locale = useLocale(); const [isExtended, setIsExtended] = useState(false); const visibleItems = useMemo( () => @@ -33,15 +34,24 @@ export const Facet = connectRefinementList( const facetTitle = useMemo(() => { switch (attribute) { case FacetAttribute.CATEGORY: - return ; + return ( + + ); case FacetAttribute.YEAR: - return ; + return ( + + ); case FacetAttribute.MONTH: - return ; + return ( + + ); default: return attribute; } - }, [attribute]); + }, [attribute, locale]); const getItemLabel = useCallback( (item: ArrayElement) => { @@ -88,9 +98,9 @@ export const Facet = connectRefinementList( {items.length > DEFAULT_FACETS_LIMIT && ( )} diff --git a/modules/Search/components/SearchBar.tsx b/modules/Search/components/SearchBar.tsx index c1e065ce9..c8c0eef4d 100644 --- a/modules/Search/components/SearchBar.tsx +++ b/modules/Search/components/SearchBar.tsx @@ -4,7 +4,7 @@ import { translations } from '@prezly/theme-kit-nextjs'; import classNames from 'classnames'; import { useState } from 'react'; -import { FormattedMessage } from '@/adapters/client'; +import { FormattedMessage, useLocale } from '@/adapters/client'; import { Button } from '@/components/Button'; import { useDevice } from '@/hooks'; import { IconMenu } from '@/icons'; @@ -17,6 +17,7 @@ import { SearchInput } from './SearchInput'; import styles from './SearchBar.module.scss'; export function SearchBar() { + const locale = useLocale(); const [isShown, setIsShown] = useState(false); const { isMobile } = useDevice(); @@ -36,12 +37,12 @@ export function SearchBar() { onClick={toggleFacets} className={styles.toggleFacets} > - + )}

- +

{AVAILABLE_FACET_ATTRIBUTES.map((attribute) => ( {searchQuery ? ( {resultsCount}, diff --git a/modules/SubscribeForm/ui/SubscribeForm.tsx b/modules/SubscribeForm/ui/SubscribeForm.tsx index 29b0706c1..2217e8d50 100644 --- a/modules/SubscribeForm/ui/SubscribeForm.tsx +++ b/modules/SubscribeForm/ui/SubscribeForm.tsx @@ -90,7 +90,7 @@ export function SubscribeForm({ newsroom }: Props) { return (

- +

@@ -111,15 +111,24 @@ export function SubscribeForm({ newsroom }: Props) { className={styles.button} loading={isSubmitting} > - +

, + subscribe: ( + + ), privacyPolicyLink: ( diff --git a/package-lock.json b/package-lock.json index 355614357..42dbe4625 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@prezly/content-renderer-react-js": "0.34.1", "@prezly/sdk": "19.10.0", "@prezly/story-content-format": "0.64.0", - "@prezly/theme-kit-nextjs": "8.2.1", + "@prezly/theme-kit-nextjs": "9.0.1", "@prezly/uploadcare": "2.4.3", "@prezly/uploadcare-image": "0.3.2", "@react-hookz/web": "14.7.1", @@ -2713,11 +2713,11 @@ } }, "node_modules/@prezly/theme-kit-core": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-core/-/theme-kit-core-8.2.0.tgz", - "integrity": "sha512-BbXz0LFqvDl4avTIbsmRGlVg331/s+U2foINkYVcSMnXRACkcrN/LUwQ9QkCaWIDtFMOGRpbS10ZeSuke+o8FA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-core/-/theme-kit-core-9.0.0.tgz", + "integrity": "sha512-K65CbZ86TqP/Xh3ZzMpQgbXlL5IAwTz9N5R1IS4BlJnElWX6Vc0+8C5y38EC+Et8wVqIuhx1E4r5RHNDxXzV/g==", "dependencies": { - "@prezly/theme-kit-intl": "^8.2.0", + "@prezly/theme-kit-intl": "^9.0.0", "@prezly/uploadcare": "^2.3.4", "@technically/is-not-undefined": "^1.0.0", "@technically/omit-undefined": "^1.0.2", @@ -2733,9 +2733,9 @@ } }, "node_modules/@prezly/theme-kit-intl": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-intl/-/theme-kit-intl-8.2.0.tgz", - "integrity": "sha512-92kBrpK8271+v9SB700jJh9pukhyigd7vGmh+ufkRpmnFzTxGvgtvEeUL/IWahoRSxbEm8gTTtn945cMqtWpsw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-intl/-/theme-kit-intl-9.0.0.tgz", + "integrity": "sha512-iXYPMYPb+NNUITSyP44/DGSr4FwLTEthe3XuoXtIv1i2Pmu6M6Imv6XDyRdbGSmwvoDSZZHG0XlDdleewhoykw==", "dependencies": { "@technically/is-not-undefined": "^1.0.0" }, @@ -2745,13 +2745,13 @@ } }, "node_modules/@prezly/theme-kit-nextjs": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-nextjs/-/theme-kit-nextjs-8.2.1.tgz", - "integrity": "sha512-LaKK4R1oKD0OnerCMFfUXtDql4j/+AQkICbsWGKJY+VliWuEfAaL94tE2y2niKhyG83zqkWGV286NaydkQ6STA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-nextjs/-/theme-kit-nextjs-9.0.1.tgz", + "integrity": "sha512-vLLtjjHmaeQ1DOyeJlLbM3RLQaChpwtTc0TYTiyENCMlFZ9oQFYUTjKy+kR2D04n9rsqezIycipDjLkzUKiOgg==", "dependencies": { - "@prezly/theme-kit-core": "^8.2.0", - "@prezly/theme-kit-intl": "^8.2.0", - "@prezly/theme-kit-react": "^8.2.0", + "@prezly/theme-kit-core": "^9.0.0", + "@prezly/theme-kit-intl": "^9.0.0", + "@prezly/theme-kit-react": "^9.0.0", "@technically/is-not-undefined": "^1.0.0", "@technically/omit-undefined": "^1.0.2", "json-stable-stringify": "^1.1.1", @@ -2776,11 +2776,11 @@ } }, "node_modules/@prezly/theme-kit-react": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-react/-/theme-kit-react-8.2.0.tgz", - "integrity": "sha512-xXsr+fhRASwBsxKpLiECmoutSNn46ixInj8aSJqyMKjrnv+bzDj3wyP1QJ20Rc6N6AZNBvk2r+b13X4DU1/vmg==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-react/-/theme-kit-react-9.0.0.tgz", + "integrity": "sha512-Q9JyIAHh8Aq1968eF033xIylpGou4ANiQqBmfv9OLjJY1V+o3XzR0MnR7jNOqHU9y/k7GohVqz35hHaF80IE9Q==", "dependencies": { - "@prezly/theme-kit-intl": "^8.2.0" + "@prezly/theme-kit-intl": "^9.0.0" }, "engines": { "node": ">= 16.x", @@ -19985,11 +19985,11 @@ } }, "@prezly/theme-kit-core": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-core/-/theme-kit-core-8.2.0.tgz", - "integrity": "sha512-BbXz0LFqvDl4avTIbsmRGlVg331/s+U2foINkYVcSMnXRACkcrN/LUwQ9QkCaWIDtFMOGRpbS10ZeSuke+o8FA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-core/-/theme-kit-core-9.0.0.tgz", + "integrity": "sha512-K65CbZ86TqP/Xh3ZzMpQgbXlL5IAwTz9N5R1IS4BlJnElWX6Vc0+8C5y38EC+Et8wVqIuhx1E4r5RHNDxXzV/g==", "requires": { - "@prezly/theme-kit-intl": "^8.2.0", + "@prezly/theme-kit-intl": "^9.0.0", "@prezly/uploadcare": "^2.3.4", "@technically/is-not-undefined": "^1.0.0", "@technically/omit-undefined": "^1.0.2", @@ -19998,21 +19998,21 @@ } }, "@prezly/theme-kit-intl": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-intl/-/theme-kit-intl-8.2.0.tgz", - "integrity": "sha512-92kBrpK8271+v9SB700jJh9pukhyigd7vGmh+ufkRpmnFzTxGvgtvEeUL/IWahoRSxbEm8gTTtn945cMqtWpsw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-intl/-/theme-kit-intl-9.0.0.tgz", + "integrity": "sha512-iXYPMYPb+NNUITSyP44/DGSr4FwLTEthe3XuoXtIv1i2Pmu6M6Imv6XDyRdbGSmwvoDSZZHG0XlDdleewhoykw==", "requires": { "@technically/is-not-undefined": "^1.0.0" } }, "@prezly/theme-kit-nextjs": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-nextjs/-/theme-kit-nextjs-8.2.1.tgz", - "integrity": "sha512-LaKK4R1oKD0OnerCMFfUXtDql4j/+AQkICbsWGKJY+VliWuEfAaL94tE2y2niKhyG83zqkWGV286NaydkQ6STA==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-nextjs/-/theme-kit-nextjs-9.0.1.tgz", + "integrity": "sha512-vLLtjjHmaeQ1DOyeJlLbM3RLQaChpwtTc0TYTiyENCMlFZ9oQFYUTjKy+kR2D04n9rsqezIycipDjLkzUKiOgg==", "requires": { - "@prezly/theme-kit-core": "^8.2.0", - "@prezly/theme-kit-intl": "^8.2.0", - "@prezly/theme-kit-react": "^8.2.0", + "@prezly/theme-kit-core": "^9.0.0", + "@prezly/theme-kit-intl": "^9.0.0", + "@prezly/theme-kit-react": "^9.0.0", "@technically/is-not-undefined": "^1.0.0", "@technically/omit-undefined": "^1.0.2", "json-stable-stringify": "^1.1.1", @@ -20021,11 +20021,11 @@ } }, "@prezly/theme-kit-react": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@prezly/theme-kit-react/-/theme-kit-react-8.2.0.tgz", - "integrity": "sha512-xXsr+fhRASwBsxKpLiECmoutSNn46ixInj8aSJqyMKjrnv+bzDj3wyP1QJ20Rc6N6AZNBvk2r+b13X4DU1/vmg==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@prezly/theme-kit-react/-/theme-kit-react-9.0.0.tgz", + "integrity": "sha512-Q9JyIAHh8Aq1968eF033xIylpGou4ANiQqBmfv9OLjJY1V+o3XzR0MnR7jNOqHU9y/k7GohVqz35hHaF80IE9Q==", "requires": { - "@prezly/theme-kit-intl": "^8.2.0" + "@prezly/theme-kit-intl": "^9.0.0" } }, "@prezly/uploadcare": { diff --git a/package.json b/package.json index 27a483cd5..5014fc439 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@prezly/content-renderer-react-js": "0.34.1", "@prezly/sdk": "19.10.0", "@prezly/story-content-format": "0.64.0", - "@prezly/theme-kit-nextjs": "8.2.1", + "@prezly/theme-kit-nextjs": "9.0.1", "@prezly/uploadcare": "2.4.3", "@prezly/uploadcare-image": "0.3.2", "@react-hookz/web": "14.7.1",