agamjotsingh18 / codesetgo

Open Source Website of CodeSetGo
https://codesetgo.netlify.app/
MIT License
76 stars 236 forks source link

refactor: implement encapsulation for theme logic into structured functions 🪄✨ #708

Closed 0xabdulkhalid closed 11 months ago

0xabdulkhalid commented 11 months ago

Related Issue

Close #693

Proposed Changes

  1. Encapsulate the dark mode logic into functions: The existing code will be refactored to encapsulate the theme setting logic into functions. This will improve the readability and make the code easier to understand.

  2. Use constants for theme values: Instead of using hard-coded theme strings, we will introduce constants for the theme values to avoid repetition and enhance code clarity.

  3. Optimize code for setting and toggling themes: The functions will be designed to handle setting the appropriate class and updating UI elements based on the selected theme. The toggleTheme() function will be responsible for toggling between light and dark mode.

  4. Improve theme initialization: The theme initialization process will be streamlined to handle user preferences or default to the dark theme if no preference is found.

Checklist

netlify[bot] commented 11 months ago

Deploy Preview for codesetgo ready!

Name Link
Latest commit fdcebd411a35c0e66e44c45eb9c30ca4c74e9504
Latest deploy log https://app.netlify.com/sites/codesetgo/deploys/64d250f00be0a20008386c6f
Deploy Preview https://deploy-preview-708--codesetgo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

0xabdulkhalid commented 11 months ago

Your review is appreciated @agamjotsingh18 👍🏻