@julseb-lib/react 0.0.36 → 0.0.37

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.
@@ -57,26 +57,30 @@ export const ThemeProviderWrapper = ({
57
57
  setSelectedTheme("dark")
58
58
  setTheme(Themes.dark)
59
59
  body.classList.add("dark")
60
- } else if (localStorage.getItem("theme") === "dark") {
61
- setSelectedTheme("dark")
62
- setTheme(Themes.dark)
63
- body.classList.add("dark")
64
- } else if (localStorage.getItem("theme") === "light") {
65
- setSelectedTheme("light")
66
- setTheme(Themes.light)
67
- body.classList.remove("dark")
68
60
  } else if (
69
61
  !localStorage.getItem("theme") ||
70
62
  localStorage.getItem("theme") === null ||
71
- localStorage.getItem("theme") === null
63
+ localStorage.getItem("theme") === undefined
72
64
  ) {
73
65
  window.localStorage.setItem("theme", "light")
66
+ setSelectedTheme("light")
67
+ setTheme(Themes.light)
68
+ } else if (localStorage.getItem("theme") === "light") {
69
+ setSelectedTheme("light")
70
+ setTheme(Themes.light)
71
+ body.classList.remove("dark")
72
+ } else if (localStorage.getItem("theme") === "dark") {
73
+ setSelectedTheme("dark")
74
+ setTheme(Themes.dark)
75
+ body.classList.add("dark")
74
76
  }
75
77
  }
76
78
  }, [selectedTheme, body])
77
79
 
78
80
  return (
79
- <ThemeContext.Provider value={{ theme, selectedTheme, toggleTheme }}>
81
+ <ThemeContext.Provider
82
+ value={{ theme: theme ?? Themes.light, selectedTheme, toggleTheme }}
83
+ >
80
84
  {stylesheetManager ? (
81
85
  <StyleSheetManager
82
86
  {...(stylesheetManager as IStyleSheetManager)}
@@ -9,6 +9,6 @@ import { COLORS_LIGHT } from "../Variables"
9
9
  */
10
10
  export const setDefaultTheme = (arr: Array<FC>) => {
11
11
  return arr.forEach(
12
- component => (component.defaultProps = { theme: COLORS_LIGHT })
12
+ component => (component.prototype = { theme: COLORS_LIGHT })
13
13
  )
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julseb-lib/react",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "scripts": {