Closed Deep-Codes closed 2 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/sliphq/run-wasm/H6QpxwjrpBAeeQTsHQQUEZ9DDYvg
✅ Preview: https://run-wasm-git-fork-deep-codes-fix-dark-mode-sliphq.vercel.app
Thanks for the PR and detailed info! Can you resolve the merge conflicts? We merged a few PR earlier today (dark mode toggle seems to be missing on your preview deploy)
Thanks for the PR and detailed info! Can you resolve the merge conflicts? We merged a few PR earlier today (dark mode toggle seems to be missing on your preview deploy)
Yeah was on it, doing
Ah one small thing is the toggle icon isn't showing up on mobile safari
Ah one small thing is the toggle icon isn't showing up on mobile safari
Adding width and height should solve it commiting
Verified on iPhone Safari let me know if anything else 👍🏽
It's great thank you!
Attempts to fix #75
There are 2 approaches for this issue
<head>
tagThis works well when was have theme data attribute in the HTML element So when the page loads we can get the theme based on preference and localStorage and assign it before the
<body>
starts executing.and then we add it to
_document.tsx
Since we aren't using the data theme attribute here instead we are assigning the theme based on className to the
body
element.next-themes
Things I have done in this PR:
next-themes
(1.59 kb)<ThemeProvider />
next-themes
uses data attribute so passingattribute="class"
<body className="bg-white dark:bg-gray-875">
useTheme()
hook to get current theme and setTheme function to toggleSome implementations
https://github.com/leerob/leerob.io/blob/7bd1fdfdb0f5bf7ad0945b14f7a0da26eaa68c11/pages/_app.tsx#L13