From 7bc2c408ee341c9125ed5b8d2280a03fcee7e7a3 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Sun, 25 Oct 2020 13:31:12 -0500 Subject: [PATCH] Added i18n for custom pages --- components/core/Footer/Footer.tsx | 29 +++++++---- lib/bigcommerce/api/catalog/products.ts | 4 +- lib/commerce/api/index.ts | 1 + package.json | 2 +- pages/[...pages].tsx | 7 ++- yarn.lock | 68 ++++++++++++------------- 6 files changed, 64 insertions(+), 47 deletions(-) diff --git a/components/core/Footer/Footer.tsx b/components/core/Footer/Footer.tsx index 2ed351c75..ac6ce738d 100644 --- a/components/core/Footer/Footer.tsx +++ b/components/core/Footer/Footer.tsx @@ -1,11 +1,13 @@ import { FC } from 'react' import cn from 'classnames' import Link from 'next/link' +import { useRouter } from 'next/router' +import type { Page } from '@lib/bigcommerce/api/operations/get-all-pages' import getSlug from '@utils/get-slug' import { Github } from '@components/icon' import { Logo, Container } from '@components/ui' -import type { Page } from '@lib/bigcommerce/api/operations/get-all-pages' import { I18nWidget } from '@components/core' + interface Props { className?: string children?: any @@ -15,8 +17,8 @@ interface Props { const LEGAL_PAGES = ['terms-of-use', 'shipping-returns', 'privacy-policy'] const Footer: FC = ({ className, pages }) => { + const { sitePages, legalPages } = usePages(pages) const rootClassName = cn(className) - const { sitePages, legalPages } = getPages(pages) return (