From 22341db48f6ad7020d46468511a7ca9e824ccd37 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Thu, 9 Mar 2023 10:45:06 +0000 Subject: [PATCH 1/3] chore(next): remove deprecated @next/font --- package-lock.json | 6 ------ package.json | 1 - util/sourceSansPro.ts | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index ce90a4f350c20..cef3756f7fedf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "dependencies": { "@mdx-js/react": "^2.3.0", - "@next/font": "^13.2.3", "classnames": "^2.3.2", "feed": "^4.2.2", "gray-matter": "^4.0.3", @@ -653,11 +652,6 @@ "glob": "7.1.7" } }, - "node_modules/@next/font": { - "version": "13.2.3", - "resolved": "https://registry.npmjs.org/@next/font/-/font-13.2.3.tgz", - "integrity": "sha512-7EHzk0f7FVYICLUZTpyPk93IfcTUao++Xt1Sgb+Zk5dVOCYHabqLtlF5ywSoXIqyFlo0qlshEBxsrzHAGTWkDw==" - }, "node_modules/@next/swc-android-arm-eabi": { "version": "13.2.3", "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-13.2.3.tgz", diff --git a/package.json b/package.json index b490669b5188c..761896942dedb 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ }, "dependencies": { "@mdx-js/react": "^2.3.0", - "@next/font": "^13.2.3", "classnames": "^2.3.2", "feed": "^4.2.2", "gray-matter": "^4.0.3", diff --git a/util/sourceSansPro.ts b/util/sourceSansPro.ts index 9e446b30d3c7b..0664c21a7496b 100644 --- a/util/sourceSansPro.ts +++ b/util/sourceSansPro.ts @@ -1,4 +1,4 @@ -import { Source_Sans_Pro } from '@next/font/google'; +import { Source_Sans_Pro } from 'next/font/google'; const sourceSansPro = Source_Sans_Pro({ weight: ['400', '600'], From 1aefeb59f0c8a64b92726c60c46132f4f3f5a6c5 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Thu, 9 Mar 2023 10:45:24 +0000 Subject: [PATCH 2/3] fix(home): fixed download button by removing next/link --- components/Home/HomeDownloadButton.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/Home/HomeDownloadButton.tsx b/components/Home/HomeDownloadButton.tsx index 707a4a4456c3e..9cd9568b1265d 100644 --- a/components/Home/HomeDownloadButton.tsx +++ b/components/Home/HomeDownloadButton.tsx @@ -1,5 +1,3 @@ -import Link from 'next/link'; - import LocalisedLink from '../LocalisedLink'; import { useNextraContext } from '../../hooks/useNextraContext'; import { getNodejsChangelog } from '../../util/getNodeJsChangelog'; @@ -25,7 +23,7 @@ const HomeDownloadButton = (props: HomeDownloadButtonProps) => { return (
- { > {props.nodeNumeric} {labels[props.isLts ? 'lts' : 'current']} {labels[`tagline-${props.isLts ? 'lts' : 'current'}`]} - +
  • From 552020d43296464ddcda956ebc9fdedbf8704df1 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Thu, 9 Mar 2023 10:50:43 +0000 Subject: [PATCH 3/3] fix(highlight): bootstrap highlight on every route change --- theme.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/theme.tsx b/theme.tsx index 38d276f9f8f2b..d77498322def2 100644 --- a/theme.tsx +++ b/theme.tsx @@ -1,6 +1,7 @@ import React, { useEffect } from 'react'; import { MDXProvider } from '@mdx-js/react'; import highlightJs from 'highlight.js/lib/common'; +import { useRouter } from 'next/router'; import type { NextraThemeLayoutProps } from 'nextra'; import type { MDXComponents } from 'mdx/types'; @@ -27,7 +28,10 @@ const mdxComponents: MDXComponents = { }; const Content = ({ children }: LayoutProps) => { - useEffect(() => highlightJs.highlightAll(), []); + const { asPath } = useRouter(); + + // Re-highlights the pages on route change + useEffect(() => highlightJs.highlightAll(), [asPath]); useEffect(() => window.startLegacyApp(), []);