diff --git a/themes/matery/components/Header.js b/themes/matery/components/Header.js index 4df222c5e5c..d6c195f802c 100644 --- a/themes/matery/components/Header.js +++ b/themes/matery/components/Header.js @@ -3,6 +3,7 @@ import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' import throttle from 'lodash.throttle' import Link from 'next/link' +import { useRouter } from 'next/router' import { useCallback, useEffect, useRef, useState } from 'react' import CONFIG from '../config' import CategoryGroup from './CategoryGroup' @@ -28,6 +29,7 @@ const Header = props => { const throttleMs = 200 const showSearchButton = siteConfig('MATERY_MENU_SEARCH', false, CONFIG) + const router = useRouter() const scrollTrigger = useCallback( throttle(() => { requestAnimationFrame(() => { @@ -85,7 +87,7 @@ const Header = props => { return () => { window.removeEventListener('scroll', scrollTrigger) } - }, []) + }, [router]) const [isOpen, changeShow] = useState(false) diff --git a/themes/matery/index.js b/themes/matery/index.js index 8889b6a8a1d..9f642cabb5d 100644 --- a/themes/matery/index.js +++ b/themes/matery/index.js @@ -201,7 +201,7 @@ const LayoutArchive = props => { const { archivePosts } = props return ( <> - +
{Object.keys(archivePosts).map(archiveTitle => ( { const { categoryOptions } = props return ( - <> -
-
-
- {categoryOptions?.map(e => { - return ( - -
- {e.name}({e.count}) -
- - ) - })} -
+
+
+
+ {categoryOptions?.map(e => { + return ( + +
+ {e.name}({e.count}) +
+ + ) + })}
- +
) } @@ -388,27 +386,25 @@ const LayoutTagIndex = props => { const { tagOptions } = props const { locale } = useGlobal() return ( - <> -
-
-
- {locale.COMMON.TAGS} -
+
+
+
+ {locale.COMMON.TAGS} +
-
- {tagOptions.map(tag => { - return ( -
- -
- ) - })} -
+
+ {tagOptions.map(tag => { + return ( +
+ +
+ ) + })}
- +
) }