-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
LightSwitch Service Improvements #737
Comments
Thanks @lairdresearch. We'll aim to take a look at this soon! Of course PRs are always welcome if you or anyone else can get to this sooner! |
I'm including this to visualize how I'd like this to work. This is just a mock, not a complete solution, but should help illustrate the goal.
|
@LukeHagar The plot thickens: https://twitter.com/zoltanszogyenyi/status/1615392521848524805 |
I am not so sure about this, the UK law and the German law is pretty much exactly the same here, so I'll quote the UK law for it:
I would argue that both the theme and the dark mode storage are requested services as soon as the user interacted with it. That's just my take and I'm not a lawyer, etc, you know the drill ;) |
this is actually an opportunity to add a nice dev feature -- since the lightswitch is stored in localstorage and this is viewed as a concern, then having that middleware available is the opportunity to ask the user if they consent to localstorage -- permission which could be used in many other places. This makes it an ideal shared piece of information. So maybe the process for dark mode is:
This would be a nice add-in for skeleton because I'm sure lots of designs need this information so you can solve it once and have it be a resource for the rest of the app. Just a thought. |
This this post about SSR issues with the current iteration of the Light Switch: Also, to review: |
Solved as part of: #922 Closing this ticket. Please refer any further comments to the ticket linked above. |
Describe what feature you'd like. Pseudo-code, mockups, or screenshots of similar solutions are encouraged!
As lightswitch is currently configured, it is assumed it will be present on every page and able to trigger the correct mode. In some cases, developers may not have lightswitch on each page or have a separate set of functions to control dark mode. In particular, LightSwitch holds its state in two stores - while these could be imported separately & managed, it would be better to have a utility function which manages that capability. Otherwise, developers will end up recreating the same code inside of LightSwitch to handle the stores themselves -- it is better to build a function with a standard interface to manage this.
I propose that the two functions currently in LightSwitch: setPrefersDarkScheme() and setElemHtmlClass(), be extracted an put into a separate file. This file can be imported into LightSwitch and used as-is. However, they could also be separately imported at other parts of the app and used to manage Dark mode without requiring LightSwitch to be present. So -- no new code, just separate it out into a different file for independant use.
Probably makes sense to change the names of the functions to something more descriptive as well.
What type of pull request would this be?
Enhancement
Any links to similar examples or other references we should review?
No response
The text was updated successfully, but these errors were encountered: