From 5547f029c2f436be163390f1c8815f437aa73440 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 6 Aug 2024 15:18:21 +0530 Subject: [PATCH] page scroll to top --- frontend/src/Component/Home.js | 20 +++++++++++--------- frontend/src/Component/Pagination.js | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/Component/Home.js b/frontend/src/Component/Home.js index 7c6219d9..a79f2877 100644 --- a/frontend/src/Component/Home.js +++ b/frontend/src/Component/Home.js @@ -115,10 +115,10 @@ function Home(props) { const filteredData = !!props.searchQuery ? allvalue.filter((datalist) => { - return datalist.productName - .toLowerCase() - .includes(props.searchQuery.toLowerCase()); - }) + return datalist.productName + .toLowerCase() + .includes(props.searchQuery.toLowerCase()); + }) : allvalue; const currentPost = @@ -132,17 +132,20 @@ function Home(props) { const prePage = () => { if (currentPage > 1) { setCurrentPage(currentPage - 1); + window.scrollTo({ top: document.body.scrollHeight * 0.2, behavior: "smooth" }); } }; const nextPage = () => { if (currentPage < npage) { setCurrentPage(currentPage + 1); + window.scrollTo({ top: document.body.scrollHeight * 0.2, behavior: "smooth" }); } }; const changeCPage = (id) => { setCurrentPage(id); + window.scrollTo({ top: document.body.scrollHeight * 0.2, behavior: "smooth" }); }; const handleBookmark = (datalist) => { @@ -305,7 +308,7 @@ function Home(props) { -
+
@@ -333,7 +336,7 @@ function Home(props) {
{searchQuery && searchResults.length === 0 && (
- empty_state_img + empty_state_img

No matching tools found.

)} @@ -353,9 +356,8 @@ function Home(props) { {filters.map((category) => (