diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-04 17:13:37 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-04 17:13:37 +0100 |
| commit | 71d133bb1c73031abbf4869bdd938e583b397773 (patch) | |
| tree | c39a85ec46131d845871a7c15c7ae9af0ed91a13 /src/components/Layouts/Layout.tsx | |
| parent | bbb7c3da2a0a7c3caa2df0610ba3b7bce25e459d (diff) | |
refactor: move Prism hook from layout to article page
I will not use Prism elsewhere, so it makes more sense to call Prism
only inside articles.
Diffstat (limited to 'src/components/Layouts/Layout.tsx')
| -rw-r--r-- | src/components/Layouts/Layout.tsx | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/components/Layouts/Layout.tsx b/src/components/Layouts/Layout.tsx index ac4a043..35e7d27 100644 --- a/src/components/Layouts/Layout.tsx +++ b/src/components/Layouts/Layout.tsx @@ -1,13 +1,9 @@ -import { ReactElement, ReactNode, useEffect } from 'react'; -import Prism from 'prismjs'; +import { ReactElement, ReactNode } from 'react'; import Footer from '@components/Footer/Footer'; import Header from '@components/Header/Header'; import Main from '@components/Main/Main'; import Breadcrumb from '@components/Breadcrumb/Breadcrumb'; import { t } from '@lingui/macro'; -import { addPrismClasses, translateCopyButton } from '@utils/helpers/prism'; -import { useRouter } from 'next/router'; -import { config } from '@config/website'; const Layout = ({ children, @@ -16,18 +12,6 @@ const Layout = ({ children: ReactNode; isHome?: boolean; }) => { - const router = useRouter(); - const locale = router.locale ? router.locale : config.defaultLocale; - - useEffect(() => { - addPrismClasses(); - Prism.highlightAll(); - }); - - useEffect(() => { - translateCopyButton(locale); - }, [locale]); - return ( <> <a href="#main" className="screen-reader-text">{t`Skip to content`}</a> |
