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
adds back to top button [Fixes #12194] #12906
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for ethereumorg ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@alex1092 Great work! Thank you! Testing this on the browser, I think the design is not right... my bad sorry Is it possible to ask you to make some changes, not to the behavior but to the position of the elements on the footer? something like this, what do you think? Doable? I change the Figma file. |
No problem I'll review this in the morning |
window.scrollTo({ top: 0, behavior: "smooth" }) | ||
} | ||
|
||
export const GoToTopButton = memo(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alex1092 memo
is not needed for this component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep no worries, there had been design changes so I need to refactor this again
) | ||
}) | ||
|
||
GoToTopButton.displayName = "GoToTopButton" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
displayName
is not required as its set automatically in this case
|
||
import { Button } from "./Buttons" | ||
|
||
const scrollToTop = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alex1092 Note that we have a scrollIntoView.ts
inside src/lib/utls
which we can use here instead of making a new "scrollToTop" component. Just pass __next
as the toId
... that will target the root Next.js div and scroll the user to the top.
ie:
import { scrollIntoView } from "@/lib/utils/scrollIntoView"
// ...
scrollIntoView("__next")
isSecondary | ||
onClick={scrollToTop} | ||
> | ||
Go to top |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to set this up for translation as well. I'm happy to do this before this gets merged when ready.
Description
Adding a go to top button [#12194]
Changelog
GoToTopButton.tsx
componentFooter.tsx
Related Issue
#12194
Screen shots
Screen.Recording.2024-05-06.at.1.07.14.PM.mov
Screen.Recording.2024-05-06.at.1.04.53.PM.mov