shyamtawli / devFind

devFind is an open source project that aims to create a platform for developers to showcase their skills and connect with potential collaborators, all in a user-friendly and searchable format.
https://dev-find.vercel.app/
MIT License
551 stars 588 forks source link

make light/dark mode theme persist on refresh #1065

Open KeithBrosch opened 5 months ago

KeithBrosch commented 5 months ago

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

Screenshots

Note to reviewers

vercel[bot] commented 5 months ago

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
KeithBrosch commented 5 months ago

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.