@t2ca/gatsby-theme-showcase 1.0.9 → 1.0.11
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 +2 -2
- package/src/components/color-mode-toggle.js +106 -70
- package/src/components/header.js +5 -19
- package/src/components/layout.js +33 -55
- package/src/components/menu-button.js +1 -1
- package/src/components/navigation-mobile.js +26 -25
- package/src/components/project.js +3 -1
- package/src/templates/project.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2ca/gatsby-theme-showcase",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"devDependencies": {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"@hot-loader/react-dom": "^16.9.0",
|
|
29
29
|
"@mdx-js/mdx": "^1.4.0",
|
|
30
30
|
"@mdx-js/react": "^1.4.0",
|
|
31
|
+
"@theme-ui/components": "^0.2.49",
|
|
31
32
|
"@theme-ui/preset-bootstrap": "^0.2.25",
|
|
32
33
|
"@theme-ui/preset-tailwind": "^0.2.30",
|
|
33
34
|
"@theme-ui/sidenav": "^0.2.36",
|
|
@@ -46,7 +47,6 @@
|
|
|
46
47
|
"gatsby-transformer-sharp": "^2.2.5",
|
|
47
48
|
"gatsby-transformer-yaml": "^2.2.1",
|
|
48
49
|
"react-google-maps": "^9.4.5",
|
|
49
|
-
"react-headroom": "^2.2.8",
|
|
50
50
|
"react-icons": "^3.7.0",
|
|
51
51
|
"react-spring": "^8.0.27",
|
|
52
52
|
"react-switch": "^5.0.0",
|
|
@@ -1,75 +1,111 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import React from "react"
|
|
3
|
-
import
|
|
2
|
+
import styled from "@emotion/styled"
|
|
3
|
+
import { useColorMode } from "theme-ui"
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
const IconWrapper = styled.button`
|
|
6
|
+
padding: 0;
|
|
7
|
+
appearance: none;
|
|
8
|
+
outline: none;
|
|
9
|
+
align-items: center;
|
|
10
|
+
background: transparent;
|
|
11
|
+
border-radius: 5px;
|
|
12
|
+
border: 0;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
height: 40px;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
opacity: 0.75;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
position: relative;
|
|
20
|
+
transform: scale(0.75);
|
|
21
|
+
transition: opacity 0.3s ease;
|
|
22
|
+
vertical-align: middle;
|
|
23
|
+
width: 40px;
|
|
24
|
+
&:hover {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
const MoonOrSun = styled.div`
|
|
30
|
+
border: ${p => (p.isDark ? `4px` : `2px`)} solid
|
|
31
|
+
${p => p.theme.colors.toggleIcon};
|
|
32
|
+
background: ${p => p.theme.colors.toggleIcon};
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
height: 24px;
|
|
35
|
+
overflow: ${p => (p.isDark ? `visible` : `hidden`)};
|
|
36
|
+
position: relative;
|
|
37
|
+
transform: scale(${p => (p.isDark ? 0.55 : 1)});
|
|
38
|
+
transition: all 0.45s ease;
|
|
39
|
+
width: 24px;
|
|
40
|
+
&::before {
|
|
41
|
+
border-radius: 50%;
|
|
42
|
+
border: 2px solid ${p => p.theme.colors.toggleIcon};
|
|
43
|
+
content: "";
|
|
44
|
+
height: 24px;
|
|
45
|
+
opacity: ${p => (p.isDark ? 0 : 1)};
|
|
46
|
+
position: absolute;
|
|
47
|
+
right: -9px;
|
|
48
|
+
top: -9px;
|
|
49
|
+
transform: translate(${p => (p.isDark ? `14px, -14px` : `0, 0`)});
|
|
50
|
+
transition: transform 0.45s ease;
|
|
51
|
+
width: 24px;
|
|
52
|
+
}
|
|
53
|
+
&::after {
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
box-shadow: 0 -23px 0 ${p => p.theme.colors.toggleIcon},
|
|
56
|
+
0 23px 0 ${p => p.theme.colors.toggleIcon},
|
|
57
|
+
23px 0 0 ${p => p.theme.colors.toggleIcon},
|
|
58
|
+
-23px 0 0 ${p => p.theme.colors.toggleIcon},
|
|
59
|
+
15px 15px 0 ${p => p.theme.colors.toggleIcon},
|
|
60
|
+
-15px 15px 0 ${p => p.theme.colors.toggleIcon},
|
|
61
|
+
15px -15px 0 ${p => p.theme.colors.toggleIcon},
|
|
62
|
+
-15px -15px 0 ${p => p.theme.colors.toggleIcon};
|
|
63
|
+
content: "";
|
|
64
|
+
height: 8px;
|
|
65
|
+
left: 50%;
|
|
66
|
+
margin: -4px 0 0 -4px;
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 50%;
|
|
69
|
+
width: 8px;
|
|
70
|
+
transform: scale(${p => (p.isDark ? 1 : 0)});
|
|
71
|
+
transition: all 0.35s ease;
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
|
|
75
|
+
const MoonMask = styled.div`
|
|
76
|
+
background: ${p => p.theme.colors.white};
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
border: 0;
|
|
79
|
+
height: 24px;
|
|
80
|
+
opacity: ${p => (p.isDark ? 0 : 1)};
|
|
81
|
+
position: absolute;
|
|
82
|
+
right: 0;
|
|
83
|
+
top: 0;
|
|
84
|
+
transform: translate(${p => (p.isDark ? `14px, -14px` : `0, 0`)});
|
|
85
|
+
transition: background 0.25s ease, transform 0.45s ease;
|
|
86
|
+
width: 24px;
|
|
87
|
+
`
|
|
88
|
+
|
|
89
|
+
const ColorModeToggle = () => {
|
|
90
|
+
const [colorMode, setColorMode] = useColorMode()
|
|
91
|
+
const isDark = colorMode === `dark`
|
|
92
|
+
|
|
93
|
+
const toggleColorMode = e => {
|
|
94
|
+
e.preventDefault()
|
|
95
|
+
setColorMode(isDark ? `light` : `dark`)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<IconWrapper
|
|
100
|
+
isDark={isDark}
|
|
101
|
+
onClick={toggleColorMode}
|
|
102
|
+
aria-label={isDark ? `Activate light mode` : `Activate dark mode`}
|
|
103
|
+
title={isDark ? `Activate light mode` : `Activate dark mode`}
|
|
28
104
|
>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
borderRadius: `50%`,
|
|
35
|
-
border: t => (isDark ? `4px solid ${t.colors.toggleIcon}` : `none`),
|
|
36
|
-
backgroundColor: isDark ? `toggleIcon` : `transparent`,
|
|
37
|
-
transform: isDark ? `scale(0.40)` : `scale(0.80)`,
|
|
38
|
-
transition: `all 0.45s ease`,
|
|
39
|
-
overflow: isDark ? `visible` : `hidden`,
|
|
40
|
-
boxShadow: t =>
|
|
41
|
-
isDark ? `none` : `inset 8px -8px 0px 0px ${t.colors.toggleIcon}`,
|
|
42
|
-
"&:before": {
|
|
43
|
-
content: `""`,
|
|
44
|
-
position: `absolute`,
|
|
45
|
-
right: `-9px`,
|
|
46
|
-
top: `-9px`,
|
|
47
|
-
height: `24px`,
|
|
48
|
-
width: `24px`,
|
|
49
|
-
border: t => (isDark ? `2px solid ${t.colors.toggleIcon}` : `none`),
|
|
50
|
-
borderRadius: `50%`,
|
|
51
|
-
transform: isDark ? `translate(14px, -14px)` : `translate(0, 0)`,
|
|
52
|
-
opacity: isDark ? 0 : 1,
|
|
53
|
-
transition: `transform 0.45s ease`,
|
|
54
|
-
},
|
|
55
|
-
"&:after": {
|
|
56
|
-
content: `""`,
|
|
57
|
-
width: `8px`,
|
|
58
|
-
height: `8px`,
|
|
59
|
-
borderRadius: `50%`,
|
|
60
|
-
margin: `-4px 0 0 -4px`,
|
|
61
|
-
position: `absolute`,
|
|
62
|
-
top: `50%`,
|
|
63
|
-
left: `50%`,
|
|
64
|
-
boxShadow: t =>
|
|
65
|
-
`0 -23px 0 ${t.colors.toggleIcon}, 0 23px 0 ${t.colors.toggleIcon}, 23px 0 0 ${t.colors.toggleIcon}, -23px 0 0 ${t.colors.toggleIcon}, 15px 15px 0 ${t.colors.toggleIcon}, -15px 15px 0 ${t.colors.toggleIcon}, 15px -15px 0 ${t.colors.toggleIcon}, -15px -15px 0 ${t.colors.toggleIcon}`,
|
|
66
|
-
transform: isDark ? `scale(1)` : `scale(0)`,
|
|
67
|
-
transition: `all 0.35s ease`,
|
|
68
|
-
},
|
|
69
|
-
}}
|
|
70
|
-
/>
|
|
71
|
-
</button>
|
|
72
|
-
</React.Fragment>
|
|
73
|
-
)
|
|
105
|
+
<MoonOrSun isDark={isDark} />
|
|
106
|
+
<MoonMask isDark={isDark} />
|
|
107
|
+
</IconWrapper>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
74
110
|
|
|
75
111
|
export default ColorModeToggle
|
package/src/components/header.js
CHANGED
|
@@ -7,24 +7,11 @@ import MenuButton from "./menu-button"
|
|
|
7
7
|
import NavLink from "./nav-link"
|
|
8
8
|
import ColorModeToggle from "./color-mode-toggle"
|
|
9
9
|
|
|
10
|
-
export default ({
|
|
11
|
-
setColorMode,
|
|
12
|
-
setMenuOpen,
|
|
13
|
-
isDark,
|
|
14
|
-
styles,
|
|
15
|
-
menuOpen,
|
|
16
|
-
nav,
|
|
17
|
-
name,
|
|
18
|
-
menuList,
|
|
19
|
-
type,
|
|
20
|
-
}) => {
|
|
21
|
-
const toggleColorMode = e => {
|
|
22
|
-
e.preventDefault()
|
|
23
|
-
setColorMode(isDark ? `light` : `dark`)
|
|
24
|
-
}
|
|
25
|
-
|
|
10
|
+
export default ({ setMenuOpen, styles, menuOpen, nav, name, menuList }) => {
|
|
26
11
|
return (
|
|
27
|
-
<Header
|
|
12
|
+
<Header
|
|
13
|
+
sx={{ ...styles, position: `fixed`, zIndex: `100`, width: `100%`, py: 2 }}
|
|
14
|
+
>
|
|
28
15
|
<Container sx={{ py: 0 }}>
|
|
29
16
|
<div
|
|
30
17
|
sx={{
|
|
@@ -34,7 +21,6 @@ export default ({
|
|
|
34
21
|
}}
|
|
35
22
|
>
|
|
36
23
|
<MenuButton
|
|
37
|
-
disabled={menuOpen}
|
|
38
24
|
onClick={e => {
|
|
39
25
|
setMenuOpen(!menuOpen)
|
|
40
26
|
// if (!props.menuOpen) return props.setMenuOpen(!props.menuOpen)
|
|
@@ -73,7 +59,7 @@ export default ({
|
|
|
73
59
|
))}
|
|
74
60
|
</div>
|
|
75
61
|
|
|
76
|
-
<ColorModeToggle
|
|
62
|
+
<ColorModeToggle />
|
|
77
63
|
</div>
|
|
78
64
|
</div>
|
|
79
65
|
</Container>
|
package/src/components/layout.js
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
import React, { useState, useRef } from "react"
|
|
3
3
|
import {
|
|
4
4
|
jsx,
|
|
5
|
-
css,
|
|
6
5
|
Layout as DefaultLayout,
|
|
7
6
|
Main,
|
|
8
|
-
Container,
|
|
9
7
|
Styled,
|
|
10
8
|
useColorMode,
|
|
11
9
|
} from "theme-ui"
|
|
12
10
|
import { Global } from "@emotion/core"
|
|
13
|
-
|
|
11
|
+
|
|
14
12
|
import {
|
|
15
13
|
withGoogleMap,
|
|
16
14
|
withScriptjs,
|
|
@@ -24,20 +22,13 @@ import jsonMapStylesDark from "./map-styles-dark"
|
|
|
24
22
|
import MobileNavigation from "./navigation-mobile"
|
|
25
23
|
import Header from "./header"
|
|
26
24
|
import Footer from "./footer"
|
|
27
|
-
// import MenuButton from "./menu-button"
|
|
28
|
-
// import Button from "./button"
|
|
29
25
|
import Sidebar from "./sidebar"
|
|
30
|
-
import Hero from "./hero"
|
|
31
26
|
|
|
32
|
-
const Layout =
|
|
27
|
+
const Layout = ({ header, main, location, children }) => {
|
|
33
28
|
const [menuOpen, setMenuOpen] = useState(false)
|
|
34
29
|
const nav = useRef(null)
|
|
35
30
|
|
|
36
|
-
const [colorMode
|
|
37
|
-
const isDark = colorMode === `dark`
|
|
38
|
-
// const toggleColorMode = e => {
|
|
39
|
-
// setColorMode(isDark ? `light` : `dark`)
|
|
40
|
-
// }
|
|
31
|
+
const [colorMode] = useColorMode()
|
|
41
32
|
|
|
42
33
|
const Map = () => {
|
|
43
34
|
return (
|
|
@@ -45,7 +36,7 @@ const Layout = props => {
|
|
|
45
36
|
defaultZoom={10}
|
|
46
37
|
defaultCenter={{ lat: 51.0486, lng: -114.0708 }}
|
|
47
38
|
defaultOptions={{
|
|
48
|
-
styles:
|
|
39
|
+
styles: colorMode === "light" ? jsonMapStyles : jsonMapStylesDark,
|
|
49
40
|
disableDefaultUI: true,
|
|
50
41
|
zoomControl: false,
|
|
51
42
|
scaleControl: false,
|
|
@@ -88,9 +79,7 @@ const Layout = props => {
|
|
|
88
79
|
/>
|
|
89
80
|
|
|
90
81
|
<Header
|
|
91
|
-
styles={
|
|
92
|
-
setColorMode={setColorMode}
|
|
93
|
-
isDark={isDark}
|
|
82
|
+
styles={header}
|
|
94
83
|
menuOpen={menuOpen}
|
|
95
84
|
setMenuOpen={setMenuOpen}
|
|
96
85
|
nav={nav}
|
|
@@ -116,55 +105,44 @@ const Layout = props => {
|
|
|
116
105
|
}}
|
|
117
106
|
/>
|
|
118
107
|
</div>
|
|
119
|
-
{/* <div
|
|
120
|
-
id="content"
|
|
121
|
-
sx={{
|
|
122
|
-
width: "100%",
|
|
123
|
-
minWidth: 0,
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
{props.children}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
</div>*/}
|
|
131
|
-
|
|
132
|
-
{/* {props.location.pathname === "/" ? <Hero isDark={isDark} /> : null}*/}
|
|
133
108
|
|
|
134
109
|
<div
|
|
135
110
|
sx={{
|
|
136
|
-
...
|
|
111
|
+
...main,
|
|
112
|
+
pt: `4.75rem`,
|
|
137
113
|
}}
|
|
138
114
|
>
|
|
139
|
-
{
|
|
115
|
+
{children}
|
|
140
116
|
</div>
|
|
141
117
|
</Main>
|
|
142
118
|
|
|
143
|
-
{
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
119
|
+
{location && location.pathname === "/contact/" ? (
|
|
120
|
+
<div sx={{ display: ["none", "initial"] }}>
|
|
121
|
+
<WrapperMap
|
|
122
|
+
googleMapURL={`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=AIzaSyBOY0sT1quks122bprrLM_0wrWLDWyVnMQ`}
|
|
123
|
+
loadingElement={<div sx={{ height: `350px` }} />}
|
|
124
|
+
containerElement={
|
|
125
|
+
<div
|
|
126
|
+
sx={{
|
|
127
|
+
height: `350px`,
|
|
128
|
+
backgroundColor: colorMode === "light" ? "#f8f9fa" : "#333",
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
}
|
|
132
|
+
mapElement={
|
|
133
|
+
<div
|
|
134
|
+
sx={{
|
|
135
|
+
height: `100%`,
|
|
136
|
+
}}
|
|
137
|
+
className="mapElement"
|
|
138
|
+
/>
|
|
139
|
+
}
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
) : null}
|
|
165
143
|
|
|
166
144
|
<Footer />
|
|
167
|
-
<MobileNavigation
|
|
145
|
+
<MobileNavigation />
|
|
168
146
|
</DefaultLayout>
|
|
169
147
|
</Styled.root>
|
|
170
148
|
)
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from "react"
|
|
3
|
-
import { jsx } from "theme-ui"
|
|
3
|
+
import { jsx, useColorMode } from "theme-ui"
|
|
4
4
|
import { Link } from "gatsby"
|
|
5
|
-
import { css } from "@emotion/core"
|
|
6
5
|
|
|
7
6
|
import Icon from "./icon"
|
|
8
7
|
|
|
9
8
|
const MobileNavItem = ({ linkTo, label, icon, isDark }) => {
|
|
9
|
+
const [colorMode] = useColorMode()
|
|
10
|
+
|
|
10
11
|
const linkStyles = {
|
|
11
|
-
borderRadius:
|
|
12
|
-
color:
|
|
13
|
-
fontSize:
|
|
14
|
-
flexShrink:
|
|
15
|
-
lineHeight:
|
|
12
|
+
borderRadius: 1,
|
|
13
|
+
color: `text`,
|
|
14
|
+
fontSize: `0.75rem`,
|
|
15
|
+
flexShrink: 0,
|
|
16
|
+
lineHeight: `none`,
|
|
16
17
|
// width: "64",
|
|
17
|
-
textDecoration:
|
|
18
|
-
textAlign:
|
|
19
|
-
|
|
20
|
-
"&:hover": { textDecoration:
|
|
18
|
+
textDecoration: `none`,
|
|
19
|
+
textAlign: `center`,
|
|
20
|
+
p: `0.75rem`,
|
|
21
|
+
"&:hover": { textDecoration: `none` },
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
return (
|
|
@@ -25,7 +26,7 @@ const MobileNavItem = ({ linkTo, label, icon, isDark }) => {
|
|
|
25
26
|
to={linkTo}
|
|
26
27
|
sx={linkStyles}
|
|
27
28
|
partiallyActive={linkTo === "/" ? false : true}
|
|
28
|
-
activeStyle={{ color:
|
|
29
|
+
activeStyle={{ color: colorMode === "light" ? `#2b6cb0` : `pink` }}
|
|
29
30
|
>
|
|
30
31
|
<span>{icon}</span>
|
|
31
32
|
<div>{label}</div>
|
|
@@ -37,19 +38,19 @@ const MobileNavigation = ({ isDark, menuList }) => (
|
|
|
37
38
|
<React.Fragment>
|
|
38
39
|
<div
|
|
39
40
|
sx={{
|
|
40
|
-
position:
|
|
41
|
-
display:
|
|
42
|
-
justifyContent:
|
|
43
|
-
bottom:
|
|
44
|
-
left:
|
|
45
|
-
right:
|
|
46
|
-
zIndex:
|
|
47
|
-
|
|
48
|
-
borderColor:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
position: `fixed`,
|
|
42
|
+
display: [`flex`, `none`],
|
|
43
|
+
justifyContent: `space-around`,
|
|
44
|
+
bottom: 0,
|
|
45
|
+
left: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
zIndex: 50,
|
|
48
|
+
bg: `Menu`,
|
|
49
|
+
borderColor: `MenuBorder`,
|
|
50
|
+
borderTopStyle: `solid`,
|
|
51
|
+
borderTopWidth: `1px`,
|
|
52
|
+
height: `3.75rem`,
|
|
53
|
+
pb: `env(safe-area-inset-bottom)`,
|
|
53
54
|
}}
|
|
54
55
|
>
|
|
55
56
|
{menuList &&
|
|
@@ -59,7 +59,9 @@ const Project = data => {
|
|
|
59
59
|
|
|
60
60
|
<div sx={{ bg: `mBg` }}>
|
|
61
61
|
<Container>
|
|
62
|
-
<
|
|
62
|
+
<div sx={{ width: `2/3`, m: `0 auto` }}>
|
|
63
|
+
<Image fluid={data.laptop.childImageSharp.fluid} sx={{}} />
|
|
64
|
+
</div>
|
|
63
65
|
</Container>
|
|
64
66
|
</div>
|
|
65
67
|
</React.Fragment>
|