diff --git a/components/HomeHero.tsx b/components/HomeHero.tsx index 5fe43f3..cc1299a 100644 --- a/components/HomeHero.tsx +++ b/components/HomeHero.tsx @@ -1,14 +1,21 @@ export function HomeHero() { return (
diff --git a/components/layout/index.tsx b/components/layout/index.tsx index 0a6fb4d..4e811f4 100644 --- a/components/layout/index.tsx +++ b/components/layout/index.tsx @@ -1,4 +1,5 @@ -import React, { ReactNode, useContext } from 'react'; +import { useRouter } from 'next/router'; +import React, { ReactNode, useContext, useEffect, useRef } from 'react'; import { useSelector } from 'react-redux'; import { UI } from '../../constants'; import { ScreenContext } from '../../contexts/screen'; @@ -17,6 +18,8 @@ export default function Layout({ children }: Props) { (state: IState) => state.navigation, ); + const router = useRouter(); + const marginLeft = `${ pageType === PageType.NORMAL && isTablet ? UI.SIDE_MENU_SIDE_BAR_WIDTH_PX @@ -27,6 +30,20 @@ export default function Layout({ children }: Props) { (pageType === PageType.BLOG || pageType === PageType.POST) && headerMobileMenuExpanded; + const ref = useRef(null); + const handleLocationChange = () => { + // Reset scroll position + ref.current.scrollTo(0, 0); + }; + + useEffect(() => { + router.events.on('routeChangeComplete', handleLocationChange); + + return () => { + router.events.off('routeChangeComplete', handleLocationChange); + }; + }, []); + return (
{ dispatch(setPageType(PageType.NORMAL)); + + // Reset scroll position + window.scrollY = 0; }, []); return ( @@ -99,7 +102,7 @@ function Page({
-

+

{page?.title}

diff --git a/pages/blog/index.tsx b/pages/blog/index.tsx index b923c5a..15d9800 100644 --- a/pages/blog/index.tsx +++ b/pages/blog/index.tsx @@ -83,7 +83,7 @@ const Blog = (props: Props) => { {generateTitle('Blog')} -
+
{!tag && posts.length && } @@ -129,7 +129,7 @@ const Blog = (props: Props) => {
{showPagination && ( -
+
'} diff --git a/pages/index.tsx b/pages/index.tsx index 225cf77..9d1b0c1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -25,7 +25,7 @@ const Index = () => { {/* Only visible when no pages are open */} -
+
diff --git a/public/hero.svg b/public/hero.svg index 86e9712..89414c9 100644 --- a/public/hero.svg +++ b/public/hero.svg @@ -12,11 +12,11 @@ id="Layer_1" x="0px" y="0px" - viewBox="1320 0 1e-05 900" + viewBox="1320 0 2.1333333e-05 1080" xml:space="preserve" sodipodi:docname="hero.svg" - width="900" - height="900" + width="1920" + height="1080" inkscape:version="1.0.1 (0767f8302a, 2020-10-17)">image/svg+xml + inkscape:current-layer="Layer_1" + inkscape:document-rotation="0" + fit-margin-top="0" + fit-margin-right="0" + fit-margin-bottom="0" />