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

adds back to top button [Fixes #12194] #12906

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

alex1092
Copy link
Contributor

@alex1092 alex1092 commented May 6, 2024

Description

Adding a go to top button [#12194]

Changelog

  • adds a GoToTopButton.tsx component
  • modifies Footer.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

@github-actions github-actions bot added the needs review 👀 Review is needed for this issue or pull request label May 6, 2024
Copy link

netlify bot commented May 6, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 5150a38
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/66387aa598b79f00084b8183
😎 Deploy Preview https://deploy-preview-12906--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 48 (🟢 up 9 from production)
Accessibility: 92 (🔴 down 1 from production)
Best Practices: 95 (🔴 down 5 from production)
SEO: 95 (🔴 down 5 from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@nloureiro
Copy link
Contributor

@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?
Screen Shot 2024-05-06 02 17 24 PM

I change the Figma file.
https://www.figma.com/file/cKWwsQVF762HM7IuSnH8xn/Footer-links-update?type=design&node-id=110%3A1413&mode=design&t=oCNCEP7J1CfRuZFA-1

@alex1092
Copy link
Contributor Author

alex1092 commented May 6, 2024

No problem I'll review this in the morning

window.scrollTo({ top: 0, behavior: "smooth" })
}

export const GoToTopButton = memo(() => {
Copy link
Member

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

Copy link
Contributor Author

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"
Copy link
Member

@nhsz nhsz May 7, 2024

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 = () => {
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review 👀 Review is needed for this issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants