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

make light/dark mode theme persist on refresh #1065

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

Conversation

KeithBrosch
Copy link

Description

Fixed the onClick behavior of the Dark/Light Mode toggle so that the theme persists on refresh.

Related Issues

[#1057]

Changes Proposed

Fixed the behavior of toggleTheme() within Sidebar.jsx to make use of our useTheme hook, and removed redundant lines of code within toggleTheme.

Now that we're properly using useTheme, we don't need to explicitly write things like:

htmlElement.classList.remove('dark');
setTheme('light');

because these changes happen dynamically for us already in other parts of the code.

Checklist

  • I have read and followed the Contribution Guidelines.
  • All new and existing tests passed.
  • I have updated the documentation to reflect the changes I've made.
  • My code follows the code style of this project.
  • The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

Copy link

vercel bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dev-find ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2024 10:12pm

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Great job, @KeithBrosch! 🎉 Thank you for opening a pull request. Your contribution is valuable and we appreciate your efforts to improve our project.

Soon the maintainers/owner will review it and provide you with feedback/suggestions.

@KeithBrosch
Copy link
Author

KeithBrosch commented Jun 19, 2024

There is another PR, #1061, that may technically fix this issue, but it doesn't make use of the useTheme hook, and instead just replicates it's functionality within toggleTheme.

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.

1 participant