Skip to content

Added BackToTop button component#271

Open
KurimineniBhavanaSree wants to merge 2 commits into
lovelymahor:mainfrom
KurimineniBhavanaSree:add-backtotop-button
Open

Added BackToTop button component#271
KurimineniBhavanaSree wants to merge 2 commits into
lovelymahor:mainfrom
KurimineniBhavanaSree:add-backtotop-button

Conversation

@KurimineniBhavanaSree
Copy link
Copy Markdown

Description

This PR adds a reusable Back To Top button component to improve navigation and overall user experience across the StudyMatePlus platform.

Currently, users have to manually scroll back to the top of long pages, which can feel inconvenient, especially on mobile devices or content-heavy pages. To solve this, I implemented a floating scroll-to-top button that becomes visible once the user scrolls down the page.

When clicked, the button smoothly scrolls the user back to the top of the page.

Changes Made

  • Created a reusable BackToTop.js component inside the components folder
  • Implemented scroll position detection using window.scrollY
  • Added conditional rendering so the button only appears after scrolling down
  • Added smooth scrolling functionality using window.scrollTo()
  • Integrated the component globally through App.js so it works across all pages
  • Styled the button with a clean circular UI and fixed positioning for better accessibility and usability
  • Added proper cleanup for the scroll event listener using useEffect

Testing Done

  • Verified that the button appears only after scrolling down
  • Tested smooth scrolling behavior on click
  • Checked functionality across multiple pages
  • Ensured there are no console errors during rendering

Fixes #183

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@KurimineniBhavanaSree is attempting to deploy a commit to the Lovely Mahour's projects Team on Vercel.

A member of the Team first needs to authorize it.

@KurimineniBhavanaSree
Copy link
Copy Markdown
Author

Kindly review my PR. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a reusable Back to Top button component

1 participant