@julseb-lib/react 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2843,19 +2843,18 @@ var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
|
2843
2843
|
var ThemeContext = (0, import_react14.createContext)(null);
|
|
2844
2844
|
var ThemeProviderWrapper = ({ children }) => {
|
|
2845
2845
|
const [theme, setTheme] = (0, import_react14.useState)("light");
|
|
2846
|
-
const docEl = document.documentElement;
|
|
2847
2846
|
const switchToLight = () => {
|
|
2848
2847
|
if (typeof window !== "undefined") {
|
|
2849
|
-
|
|
2850
|
-
|
|
2848
|
+
document.documentElement.classList.add("light");
|
|
2849
|
+
document.documentElement.classList.remove("dark");
|
|
2851
2850
|
setTheme("light");
|
|
2852
2851
|
localStorage.setItem("theme", "light");
|
|
2853
2852
|
}
|
|
2854
2853
|
};
|
|
2855
2854
|
const switchToDark = () => {
|
|
2856
2855
|
if (typeof window !== "undefined") {
|
|
2857
|
-
|
|
2858
|
-
|
|
2856
|
+
document.documentElement.classList.remove("light");
|
|
2857
|
+
document.documentElement.classList.add("dark");
|
|
2859
2858
|
setTheme("dark");
|
|
2860
2859
|
localStorage.setItem("theme", "dark");
|
|
2861
2860
|
}
|
|
@@ -2872,7 +2871,7 @@ var ThemeProviderWrapper = ({ children }) => {
|
|
|
2872
2871
|
else switchToLight();
|
|
2873
2872
|
}
|
|
2874
2873
|
}
|
|
2875
|
-
}, [theme
|
|
2874
|
+
}, [theme]);
|
|
2876
2875
|
const switchTheme = () => {
|
|
2877
2876
|
if (theme === "light") switchToDark();
|
|
2878
2877
|
else switchToLight();
|