@t2ca/gatsby-theme-showcase 1.0.120 → 1.0.121
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/package.json
CHANGED
|
@@ -87,24 +87,24 @@ const MoonMask = styled.div`
|
|
|
87
87
|
`
|
|
88
88
|
|
|
89
89
|
const ColorModeToggle = () => {
|
|
90
|
-
|
|
90
|
+
const [hasMounted, setHasMounted] = useState(false)
|
|
91
91
|
const context = useThemeUI()
|
|
92
92
|
const { theme, colorMode, setColorMode } = context
|
|
93
93
|
const isDark = colorMode === `dark`
|
|
94
94
|
|
|
95
|
-
// useEffect(() => {
|
|
96
|
-
// setHasMounted(true)
|
|
97
|
-
// }, [])
|
|
98
|
-
|
|
99
|
-
// if (!hasMounted) {
|
|
100
|
-
// return null
|
|
101
|
-
// }
|
|
102
|
-
|
|
103
95
|
const toggleColorMode = (e) => {
|
|
104
96
|
e.preventDefault()
|
|
105
97
|
setColorMode(isDark ? `default` : `dark`)
|
|
106
98
|
}
|
|
107
99
|
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
setHasMounted(true)
|
|
102
|
+
}, [])
|
|
103
|
+
|
|
104
|
+
if (!hasMounted) {
|
|
105
|
+
return null
|
|
106
|
+
}
|
|
107
|
+
|
|
108
108
|
return (
|
|
109
109
|
<IconWrapper
|
|
110
110
|
onClick={toggleColorMode}
|
package/src/components/footer.js
CHANGED
package/src/components/header.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { useEffect } from "react"
|
|
2
|
+
import { useState, useEffect } from "react"
|
|
3
3
|
import { Link } from "gatsby"
|
|
4
4
|
import { jsx, Container, Box, Alert } from "theme-ui"
|
|
5
5
|
import NavLink from "./nav-link"
|
|
@@ -29,10 +29,10 @@ export default ({
|
|
|
29
29
|
svgLogo,
|
|
30
30
|
button,
|
|
31
31
|
alertMsg,
|
|
32
|
-
|
|
32
|
+
callBack,
|
|
33
33
|
}) => {
|
|
34
34
|
useEffect(() => {
|
|
35
|
-
|
|
35
|
+
callBack(alertMsg ? true : false)
|
|
36
36
|
}, [])
|
|
37
37
|
|
|
38
38
|
return (
|
package/src/components/layout.js
CHANGED
|
@@ -10,18 +10,14 @@ import Footer from "./footer"
|
|
|
10
10
|
import Sidebar from "./sidebar"
|
|
11
11
|
|
|
12
12
|
const Layout = ({ header, children }) => {
|
|
13
|
-
const [hasMounted, setHasMounted] = useState(false)
|
|
14
13
|
const [menuOpen, setMenuOpen] = useState(false)
|
|
15
|
-
const [isAlert, setIsAlert] = useState(
|
|
14
|
+
const [isAlert, setIsAlert] = useState(false)
|
|
15
|
+
const [hasMounted, setHasMounted] = useState(false)
|
|
16
16
|
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
setHasMounted(true)
|
|
19
19
|
}, [])
|
|
20
20
|
|
|
21
|
-
if (!hasMounted) {
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
21
|
return (
|
|
26
22
|
<Themed.root>
|
|
27
23
|
<Global
|
|
@@ -42,20 +38,22 @@ const Layout = ({ header, children }) => {
|
|
|
42
38
|
styles={header}
|
|
43
39
|
menuOpen={menuOpen}
|
|
44
40
|
setMenuOpen={setMenuOpen}
|
|
45
|
-
|
|
41
|
+
callBack={setIsAlert}
|
|
46
42
|
/>
|
|
47
43
|
|
|
48
44
|
<Sidebar open={menuOpen} isAlert={isAlert} />
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
{!hasMounted ? null : (
|
|
47
|
+
<div
|
|
48
|
+
sx={{
|
|
49
|
+
pt: isAlert ? `6.875rem` : `4.25rem`,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
|
|
56
|
+
<Footer />
|
|
59
57
|
|
|
60
58
|
<MobileNavigation />
|
|
61
59
|
</Themed.root>
|