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

Scroll to top feature #729

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Scroll to top feature #729

wants to merge 11 commits into from

Conversation

iitzIrFan
Copy link

Resolves #614

Had added scroll to top button that becomes visible when the user scrolls down a certain distance. Clicking this button would smoothly scroll the page back to the top. The button should be styled minimally and placed in the bottom-right corner of the viewport for easy access.

Also keeping the requirements of this issue to be :-

  • The button should be responsive and not obstruct other page elements.
  • It can include animations

@abhayymishraa
Copy link
Collaborator

Hey @iitzIrFan , it would be great if you could provide an implementation video or a screenshot of the task you’ve completed

@iitzIrFan
Copy link
Author

@abhayymishraa
Implementation video :-

2025-02-03.22-50-36.mp4

Also the server error is due to missing Algolia api key !
Thank you !

@github-actions github-actions bot removed the schema label Feb 3, 2025
Copy link
Collaborator

@aramattamara aramattamara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this scroll up button!
Could you please change the color in light theme, to match the theme color.

Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iitzIrFan thanks for working on this!
I noticed that CI\CD is failing. Could you run make check and address anything that pops up there? This is our normal workflow to run make check every time before pushing anything.
Will review again after the updates! 👌🏼

@iitzIrFan
Copy link
Author

@arkid15r @kasya @aramattamara
Updated as per the changes.
Thank you

@arkid15r arkid15r changed the title scroll up feature. Scroll to top feature Feb 5, 2025
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you resolve conflicts and fix code style?

@arkid15r arkid15r marked this pull request as draft February 6, 2025 18:47
@arkid15r arkid15r marked this pull request as ready for review February 8, 2025 18:39
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iitzIrFan any updates on this?

@arkid15r arkid15r marked this pull request as draft February 12, 2025 01:48
@iitzIrFan
Copy link
Author

iitzIrFan commented Feb 12, 2025

@arkid15r Sorry, I didn't inform you. will update you till 15th as currently in middle of exams

@iitzIrFan iitzIrFan marked this pull request as ready for review February 13, 2025 19:22
Copy link
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iitzIrFan! Is this updated and ready for another round of review?

@iitzIrFan
Copy link
Author

Hi @iitzIrFan! Is this updated and ready for another round of review?

Will update !

@iitzIrFan
Copy link
Author

@kasya mam you can review this now update me if, there is any issue.
Thank you !

Comment on lines 1 to 31
import React, { useEffect, useState } from 'react'

const ScrollUp = () => {
const [isVisible, setIsVisible] = useState(false)

// Show button when page is scrolled up to given distance
const toggleVisibility = () => {
if (window.pageYOffset > 300) {
setIsVisible(true)
} else {
setIsVisible(false)
}
}

const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth',
})
}

useEffect(() => {
window.addEventListener('scroll', toggleVisibility)
return () => {
window.removeEventListener('scroll', toggleVisibility)
}
}, [])

return (
<>
{isVisible && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see this file in the PR. Since the same file already exists in .tsx format in this PR, could you please clarify if this one is needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate here as there is some misunderstanding issue I guess !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this PR, there are two files: frontend/src/components/ScrollUp.jsx and frontend/src/components/ScrollUp.tsx. The content inside both files is nearly identical. Since our project uses TypeScript, it seems that the .jsx file was added by mistake

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok will update this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Scroll On top Button
6 participants