From 152af7e4cf6c1a50660e3c1f2d66883df35ece5d Mon Sep 17 00:00:00 2001 From: damedotblog Date: Mon, 3 Mar 2025 13:58:18 -0500 Subject: [PATCH] fix scroll --- src/components/Supporter/Supporter.css | 2 ++ src/components/common/RelatedPagesNav.jsx | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/Supporter/Supporter.css b/src/components/Supporter/Supporter.css index e821df5..855384f 100644 --- a/src/components/Supporter/Supporter.css +++ b/src/components/Supporter/Supporter.css @@ -22,6 +22,8 @@ display: flex; gap: 17.3px; justify-content: center; + margin-top: 20px; + margin-bottom: 30px; } .patreon-button { diff --git a/src/components/common/RelatedPagesNav.jsx b/src/components/common/RelatedPagesNav.jsx index 51f75a8..9fdb552 100644 --- a/src/components/common/RelatedPagesNav.jsx +++ b/src/components/common/RelatedPagesNav.jsx @@ -1,7 +1,5 @@ -// src/components/common/RelatedPagesNav.jsx - import React from 'react'; -import { Link } from 'react-router-dom'; +import { Link, useNavigate } from 'react-router-dom'; import './RelatedPagesNav.css'; const RelatedPagesNav = ({ currentPage }) => { @@ -27,21 +25,35 @@ const RelatedPagesNav = ({ currentPage }) => { } ]; + const navigate = useNavigate(); + // Filter out the current page const otherPages = pages.filter(page => page.id !== currentPage); + // Function to handle navigation and scroll to top + const handleNavigation = (path, e) => { + e.preventDefault(); + navigate(path); + window.scrollTo(0, 0); + }; + return (

Related Pages

{otherPages.map(page => ( - + handleNavigation(page.path, e)} + >

{page.title}

{page.description}

→ - +
))}
-- 2.51.2