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

Add homepage confetti effect for 50th Remote Hack celebration #216

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

Conversation

benfoxall
Copy link
Member

@benfoxall benfoxall commented Jun 23, 2024

Adds a celebratory confetti effect to the homepage for the 50th Remote Hack event, respecting user preferences for reduced motion and only triggering under specific conditions.

  • Implements the confetti effect: Adds a new JavaScript file assets/confetti.js that creates a falling confetti effect using plain JavaScript. This effect respects the "prefers-reduced-motion" media query and automatically stops generating new confetti after 5 seconds.
  • Enables celebration condition: Modifies _hacks/50.md to include celebrate: true in the front matter, which is used to conditionally trigger the confetti effect.
  • Integrates the confetti script: Updates _layouts/default.html to conditionally include the confetti.js script based on the celebrate: true condition in the front matter of the event page.

For more details, open the Copilot Workspace session.

Comment on lines +53 to +57
setInterval(createConfetti, 100);

// Stop creating confettis after 5 seconds
setTimeout(() => {
clearInterval(createConfetti);
Copy link
Member Author

Choose a reason for hiding this comment

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

There's no interval id being stored, so it'll never stop 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

If you can limit it easily to just the homepage then I think this is fine

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep I guess it is fine! I thought it was worth noting that the code from Copilot Workspace Preview has syntax issues 😓

confetti.y += confetti.speed;
confetti.x += Math.cos(confetti.angle) * confetti.speed;

// Remove confetti that are out of the screen
Copy link
Contributor

Choose a reason for hiding this comment

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

If we don't do this, it is basically just a memory leak?

@benfoxall
Copy link
Member Author

@lpmi-13 I generated this PR using the Copilot Workspace Preview 😎 . It took me a few attempts to get this PR, and I think there's still some issues with it! Will try and fix it up and merge if I get a chance.

Screenshot 2024-06-23 at 12 18 39

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.

2 participants