@t2ca/gatsby-theme-showcase 1.0.118 → 1.0.119
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,18 +87,18 @@ const MoonMask = styled.div`
|
|
|
87
87
|
`
|
|
88
88
|
|
|
89
89
|
const ColorModeToggle = () => {
|
|
90
|
-
const [hasMounted, setHasMounted] = useState(false)
|
|
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
|
-
|
|
97
|
-
}, [])
|
|
95
|
+
// useEffect(() => {
|
|
96
|
+
// setHasMounted(true)
|
|
97
|
+
// }, [])
|
|
98
98
|
|
|
99
|
-
if (!hasMounted) {
|
|
100
|
-
|
|
101
|
-
}
|
|
99
|
+
// if (!hasMounted) {
|
|
100
|
+
// return null
|
|
101
|
+
// }
|
|
102
102
|
|
|
103
103
|
const toggleColorMode = (e) => {
|
|
104
104
|
e.preventDefault()
|
package/src/components/header.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from "react"
|
|
2
3
|
import { Link } from "gatsby"
|
|
3
4
|
import { jsx, Container, Box, Alert } from "theme-ui"
|
|
4
5
|
import NavLink from "./nav-link"
|
|
@@ -28,9 +29,12 @@ export default ({
|
|
|
28
29
|
svgLogo,
|
|
29
30
|
button,
|
|
30
31
|
alertMsg,
|
|
31
|
-
|
|
32
|
+
setIsAlert,
|
|
32
33
|
}) => {
|
|
33
|
-
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setIsAlert(alertMsg ? true : false)
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
34
38
|
return (
|
|
35
39
|
<div sx={{ position: `fixed`, zIndex: `100`, width: `100%` }}>
|
|
36
40
|
{alertMsg && <Alert variant="banner">{alertMsg}</Alert>}
|
package/src/components/layout.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { useState } from "react"
|
|
2
|
+
import { useState, useEffect } from "react"
|
|
3
3
|
import { jsx, Themed } from "theme-ui"
|
|
4
4
|
import { Global } from "@emotion/react"
|
|
5
5
|
import { Helmet } from "react-helmet"
|
|
@@ -10,11 +10,16 @@ import Footer from "./footer"
|
|
|
10
10
|
import Sidebar from "./sidebar"
|
|
11
11
|
|
|
12
12
|
const Layout = ({ header, children }) => {
|
|
13
|
+
const [hasMounted, setHasMounted] = useState(false)
|
|
13
14
|
const [menuOpen, setMenuOpen] = useState(false)
|
|
14
15
|
const [isAlert, setIsAlert] = useState(null)
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setHasMounted(true)
|
|
19
|
+
}, [])
|
|
20
|
+
|
|
21
|
+
if (!hasMounted) {
|
|
22
|
+
return null
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
return (
|
|
@@ -37,7 +42,7 @@ const Layout = ({ header, children }) => {
|
|
|
37
42
|
styles={header}
|
|
38
43
|
menuOpen={menuOpen}
|
|
39
44
|
setMenuOpen={setMenuOpen}
|
|
40
|
-
|
|
45
|
+
setIsAlert={setIsAlert}
|
|
41
46
|
/>
|
|
42
47
|
|
|
43
48
|
<Sidebar open={menuOpen} />
|