@t2ca/gatsby-theme-showcase 1.0.118 → 1.0.120

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t2ca/gatsby-theme-showcase",
3
- "version": "1.0.118",
3
+ "version": "1.0.120",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "devDependencies": {
@@ -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
- setHasMounted(true)
97
- }, [])
95
+ // useEffect(() => {
96
+ // setHasMounted(true)
97
+ // }, [])
98
98
 
99
- if (!hasMounted) {
100
- return null
101
- }
99
+ // if (!hasMounted) {
100
+ // return null
101
+ // }
102
102
 
103
103
  const toggleColorMode = (e) => {
104
104
  e.preventDefault()
@@ -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
- callBack,
32
+ setIsAlert,
32
33
  }) => {
33
- callBack(alertMsg ? true : false)
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>}
@@ -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
- const getAlertBoolean = (item) => {
17
- setIsAlert(item)
17
+ useEffect(() => {
18
+ setHasMounted(true)
19
+ }, [])
20
+
21
+ if (!hasMounted) {
22
+ return null
18
23
  }
19
24
 
20
25
  return (
@@ -37,10 +42,10 @@ const Layout = ({ header, children }) => {
37
42
  styles={header}
38
43
  menuOpen={menuOpen}
39
44
  setMenuOpen={setMenuOpen}
40
- callBack={getAlertBoolean}
45
+ setIsAlert={setIsAlert}
41
46
  />
42
47
 
43
- <Sidebar open={menuOpen} />
48
+ <Sidebar open={menuOpen} isAlert={isAlert} />
44
49
 
45
50
  <div
46
51
  sx={{
@@ -3,14 +3,14 @@ import { jsx } from "theme-ui"
3
3
  import { Sidenav } from "@theme-ui/sidenav"
4
4
  import NavLink from "./nav-link"
5
5
 
6
- export default ({ menuLinks, open }) => {
6
+ export default ({ menuLinks, open, isAlert }) => {
7
7
  return (
8
8
  <Sidenav
9
9
  sx={{
10
10
  px: 3,
11
11
  pt: 3,
12
12
  pb: 4,
13
- mt: [110, 110, 0],
13
+ mt: isAlert ? [`110px`, `110px`, 0] : [`68px`, `68px`, 0],
14
14
  position: ["fixed", "fixed", "sticky"],
15
15
  bottom: [0, 0, "auto"],
16
16
  maxHeight: ["100vh", "100vh", "none"],