Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page scroll to top #2689

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions frontend/src/Component/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,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 =
Expand All @@ -128,17 +128,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) => {
Expand Down Expand Up @@ -303,10 +306,13 @@ function Home(props) {
</h1>
</h1>


<div className="hero-button-container" style={{ display: "flex", justifyContent: "center" }}>
<div
className="hero-button-container"
style={{ display: "flex", justifyContent: "center" }}
>

<button className="hero-button">
<NavbarItem description="Get Started" to="/open-source" />
</button>
Expand Down Expand Up @@ -334,13 +340,17 @@ function Home(props) {
<br />
{searchQuery && searchResults.length === 0 && (
<div className="no-results">

<img src="./empty-state.png" height={"300px"} width={"300px"} style={{ background: "none" }} alt="empty_state_img" />

<img
src="./empty-state.png"
height={"300px"}
width={"300px"}
style={{ background: "none" }}
alt="empty_state_img"
/>

<h1>No matching tools found.</h1>
</div>
)}
Expand All @@ -360,9 +370,8 @@ function Home(props) {
{filters.map((category) => (
<button
key={category}
className={`filter-button ${
selectedFilters.includes(category) ? "active_filter" : ""
}`}
className={`filter-button ${selectedFilters.includes(category) ? "active_filter" : ""
}`}
onClick={() => handleFilterButtonClick(category)}
>
{category}
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/Component/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const Pagination = ({
handlePageChange,
scrollPosition
}) => {


return (
<nav>
<div className="page-index">
Expand Down
Loading