Skip to content

feat: Add Scroll-to-Top Button Component | Fixes #576#579

Open
Yugal0708 wants to merge 1 commit into
lovelymahor:mainfrom
Yugal0708:feature/scroll-to-top
Open

feat: Add Scroll-to-Top Button Component | Fixes #576#579
Yugal0708 wants to merge 1 commit into
lovelymahor:mainfrom
Yugal0708:feature/scroll-to-top

Conversation

@Yugal0708

Copy link
Copy Markdown

📌 What does this PR do?

Adds a ScrollToTop reusable React component that improves navigation UX
for long pages (PYQs listings, syllabus pages, etc.).

✅ Changes Made

  • Added client/src/components/ScrollToTop.jsx — functional component with scroll listener
  • Added client/src/components/ScrollToTop.css — responsive styling
  • Imported and rendered <ScrollToTop /> in App.jsx

🧠 How it works

  • Uses useEffect to attach a scroll event listener
  • Button becomes visible after scrolling 300px down
  • On click, window.scrollTo({ top: 0, behavior: 'smooth' }) triggers smooth scroll
  • Cleans up event listener on component unmount (no memory leaks)

📱 Tested on

  • Desktop (Chrome)
  • Mobile viewport (responsive)
  • No console errors

🔗 Related Issue

Closes #576


GSSoC 2025 Contributor | Made by @Yugal0708

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@Yugal0708 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.

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.

[Feature] Add Scroll-to-Top Button Component for Better Navigation UX

1 participant