Skip to content

Take system's theme for the beta site #4022

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

Merged
merged 4 commits into from
Nov 4, 2021

Conversation

harish-sethuraman
Copy link
Collaborator

@harish-sethuraman harish-sethuraman commented Oct 29, 2021

If the user has dark theme as preferred color scheme. apply dark mode.

It was a todo in the code 😄
// TODO: respect system pref

@gaearon
Copy link
Member

gaearon commented Nov 3, 2021

This won't work for the initial render. It will flash.

@harish-sethuraman
Copy link
Collaborator Author

Shall I add an IIFE to the document then? Like you had done in over reacted site? https://github.com/gaearon/overreacted.io/blob/master/src/html.js#L21
and then preserve it in the local storage?

@gaearon
Copy link
Member

gaearon commented Nov 4, 2021

Seems like this doesn’t work for sandboxes?

@harish-sethuraman
Copy link
Collaborator Author

Do you mean for the sandpack component in the site? 🤔

@gaearon
Copy link
Member

gaearon commented Nov 4, 2021

Oh I see. That's in #4019. We need to figure out what to get in first.

@gaearon
Copy link
Member

gaearon commented Nov 4, 2021

When I load a preview on this branch with initial Dark more, I see the toggle flash.

@gaearon
Copy link
Member

gaearon commented Nov 4, 2021

What's happening here is that the SSR content always assumes the theme is light. You should either hide the toggle or show the correct toggle icon with CSS.

@harish-sethuraman
Copy link
Collaborator Author

Will work on it and push changes for toggle.

@gaearon
Copy link
Member

gaearon commented Nov 4, 2021

I think I'll take it over from here. Thanks!

@gaearon
Copy link
Member

gaearon commented Nov 4, 2021

thanks!

@gaearon gaearon added the beta label Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants