diff --git a/components/Header.tsx b/components/Header.tsx index 3caa32a..c2b77f0 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,4 +1,4 @@ -import {usePathname} from 'next/navigation' +import {useRouter} from 'next/router' import {useEffect, useRef} from 'react' import {Container} from './Container' import {MobileNavigation, DesktopNavigation} from './ui/Navigation' @@ -50,7 +50,8 @@ function clamp(num: number, a: number, b: number) { } export function Header() { - const isHomePage = usePathname() === '/' + const router = useRouter() + const isHomePage = router.pathname === '/' const headerRef = useRef(null) const avatarRef = useRef(null) diff --git a/components/layouts/ArticleLayout.tsx b/components/layouts/ArticleLayout.tsx index eb39ac1..9d36d2e 100644 --- a/components/layouts/ArticleLayout.tsx +++ b/components/layouts/ArticleLayout.tsx @@ -1,12 +1,11 @@ import React, {ReactNode} from 'react' import Head from 'next/head' -import {usePathname} from 'next/navigation' +import Link from 'next/link' import {Container} from '@/components/Container' import {Prose} from '@/components/ui/Prose' import {Views} from '@/components/ui/Views' import {ArrowDownIcon} from '@/components/icons/ArrowDownIcon' import {formatDate} from '@/lib/formatDate' -import Link from 'next/link' type ArticleLayout = { children?: ReactNode @@ -27,8 +26,6 @@ export function ArticleLayout({ date, slug }: ArticleLayout) { - const pathname = usePathname() - if (isRssFeed) { return children } @@ -40,7 +37,7 @@ export function ArticleLayout({