-
-
Notifications
You must be signed in to change notification settings - Fork 17
Feat #6 night mode toggler #17
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
base: master
Are you sure you want to change the base?
Conversation
cassidyjames
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on! A couple of initial critiques:
-
How does this interact with a browser's native dark style? I think the JS is going to need to be aware of whether or not the site is already in a dark style due to the browser/OS requesting a dark style.
-
We should make sure to only create the toggle UI when JS is available, otherwise there's a non-functional action for users who don't enable JS.
-
I think I'd like to use a switch or other UI control instead of a link, but I understand that requires more CSS work to style that. That could come in a future PR.
-
Can we combine the existing dark styles with the new class to avoid duplication?
|
I've done point 2 and point 4 (mixins).
About 3 - what element, on your opinion will be semantic correct? Maybe |
|
We should definitely not be setting the page style in JS when CSS is available. JS just needs to know what state the page is in to override if the option is changed, not set it initially. Personally I would use a checkbox styled as a toggle switch. |
|
|
Ok, I've added mirror mixins to light mode. It works without JS and with JS styles should overlap correctly. Check it please. |
|
Notify me please, if all is ok (I'm going to do rebase with squash). |
|
My initial thought is that there is a lot of styling that's been pulled out into the mixins that is going to be hard to keep track of. I think keeping the components' styling in their original file would be more maintainable. |
|
@danrabbit Has conflicts and no recent activity. Does this need closing or converting to draft? I do not have the necessary rights. |
Feature #6
Solution: Added JS function and listener to save and handle current state in localStorage. Added new scss file with night mode styles (wrapped into .night-mode).