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

Workspace test: Add 'Back to Top' button across all pages #275

Closed
wants to merge 5 commits into from

Conversation

bdougie
Copy link
Member

@bdougie bdougie commented May 15, 2024

Related to #272

Implements a 'Back to Top' button in the PageLayout component to enhance user navigation across all pages.

  • Adds state management and a scroll event listener to display the button when the user scrolls down more than 300 pixels.
  • Implements a scrollToTop function that smoothly scrolls the user back to the top of the page when the button is clicked.
  • Styles the button with Tailwind CSS classes for consistency with the site's design, positioning it fixed at the bottom-right corner of the viewport.

For more details, open the Copilot Workspace session.

Copy link

netlify bot commented May 15, 2024

Deploy Preview for opensauced-landing ready!

Name Link
🔨 Latest commit 202936f
🔍 Latest deploy log https://app.netlify.com/sites/opensauced-landing/deploys/6646e2c314eca50008e31885
😎 Deploy Preview https://deploy-preview-275--opensauced-landing.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 91 (no change from production)
Best Practices: 92 (no change from production)
SEO: 83 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

Copy link
Member

@BekahHW BekahHW left a comment

Choose a reason for hiding this comment

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

Do we want to move the product hunt badge so it doesn't overlap?

image

@bdougie
Copy link
Member Author

bdougie commented May 16, 2024

Do we want to move the product hunt badge so it doesn't overlap?

image

I am actually going to close this. Just wanted to test Copilot Workspaces. I don't think this is needed on every page, just blog posts.

};
}, []);

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.

I know you're closing this, but all you need instead of a button and useEffect etc. is a link. There is a native #top anchor.

Back to top and you can enable smooth scrolling to make it work SMOOOOTHH.

Replaces the 'Back to Top' button with a link and removes scroll handling logic in PageLayout component.
- Removes `useState`, `useEffect`, and the `scrollToTop` function, simplifying the component by eliminating scroll event listeners and state management for showing the button.
- Introduces a direct link to `#top` using an anchor tag, enabling native browser handling for smooth scrolling back to the top of the page without custom JavaScript logic.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/open-sauced/landing-page/pull/275?shareId=0b9298fa-ea07-40a3-850c-cb8a980be302).
@bdougie
Copy link
Member Author

bdougie commented May 17, 2024

Replaces the 'Back to Top' button with a link and removes scroll handling logic in PageLayout component.

  • Removes useState, useEffect, and the scrollToTop function, simplifying the component by eliminating scroll event listeners and state management for showing the button.
  • Introduces a direct link to #top using an anchor tag, enabling native browser handling for smooth scrolling back to the top of the page without custom JavaScript logic.

For more details, open the Copilot Workspace session.

@bdougie
Copy link
Member Author

bdougie commented May 17, 2024

So I was surprise how close this got to being successful in a one shot prompt. I guess I am mostly just testing out Copliot Workspaces, but after copying @nickytonline's suggestion wholesell into the prompt and getting this commit bab3c96, makes me want to move this PR forward.

@bdougie
Copy link
Member Author

bdougie commented May 17, 2024

Implements CSS-only visibility control for the "Back to Top" button based on page scroll.

  • Adds an id attribute to the main container in PageLayout.tsx to target it for the CSS scroll effect.
  • Modifies the "Back to Top" button's class to include a CSS class for scroll visibility control.
  • Updates globals.css with rules to hide the "Back to Top" button by default and to animate its visibility based on page scroll using @keyframes and the :target pseudo-class.

For more details, open the Copilot Workspace session.

Implements CSS-only visibility control for the "Back to Top" button based on page scroll.

- Adds an `id` attribute to the main container in `PageLayout.tsx` to target it for the CSS scroll effect.
- Modifies the "Back to Top" button's class to include a CSS class for scroll visibility control.
- Updates `globals.css` with rules to hide the "Back to Top" button by default and to animate its visibility based on page scroll using `@keyframes` and the `:target` pseudo-class.


---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/open-sauced/landing-page/pull/275?shareId=043f35c1-8619-450d-98b0-210ddbf55190).
@bdougie bdougie closed this May 17, 2024
@bdougie
Copy link
Member Author

bdougie commented May 17, 2024

Closing for now. I don't think this is priority and there is still some clean up needed to make this work in CSS.

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.

3 participants