mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-02 02:10:27 +00:00
Fix scrolling bug in content pages
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { FC } from 'react';
|
import { FC, useEffect } from 'react';
|
||||||
import { getBlogPostsSlugs, getBlogPostdata } from '../../lib/blog';
|
import { getBlogPostsSlugs, getBlogPostdata } from '../../lib/blog';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { MdxRemote } from 'next-mdx-remote/types';
|
import { MdxRemote } from 'next-mdx-remote/types';
|
||||||
@@ -110,6 +110,10 @@ const BlogPost: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
const content = hydrate(source, { components });
|
const content = hydrate(source, { components });
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FC } from 'react';
|
import { FC, useEffect } from 'react';
|
||||||
import { getPortfolioPorjectsSlugs, getPortfolioProjectdata } from '../../lib/portfolio';
|
import { getPortfolioPorjectsSlugs, getPortfolioProjectdata } from '../../lib/portfolio';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
import { MdxRemote } from 'next-mdx-remote/types';
|
import { MdxRemote } from 'next-mdx-remote/types';
|
||||||
@@ -101,6 +101,10 @@ const PortfolioProject: FC<Props> = ({ source, frontMatter }) => {
|
|||||||
const content = hydrate(source, { components });
|
const content = hydrate(source, { components });
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
|
|||||||
Reference in New Issue
Block a user