@t2ca/gatsby-theme-showcase 1.0.0 → 1.0.2

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.
@@ -7,6 +7,7 @@ import {
7
7
  Main,
8
8
  Container,
9
9
  Styled,
10
+ useColorMode,
10
11
  } from "theme-ui"
11
12
  import { Global } from "@emotion/core"
12
13
  import Headroom from "react-headroom"
@@ -16,17 +17,27 @@ import {
16
17
  GoogleMap,
17
18
  Marker,
18
19
  } from "react-google-maps"
20
+
19
21
  import jsonMapStyles from "./map-styles"
22
+ import jsonMapStylesDark from "./map-styles-dark"
20
23
 
24
+ import MobileNavigation from "./navigation-mobile"
21
25
  import Header from "./header"
22
26
  import Footer from "./footer"
23
27
  // import MenuButton from "./menu-button"
24
28
  // import Button from "./button"
25
- // import Sidebar from "./sidebar"
29
+ import Sidebar from "./sidebar"
30
+ import Hero from "./hero"
26
31
 
27
32
  const Layout = props => {
28
- // const [menuOpen, setMenuOpen] = useState(false)
29
- // const nav = useRef(null)
33
+ const [menuOpen, setMenuOpen] = useState(false)
34
+ const nav = useRef(null)
35
+
36
+ const [colorMode, setColorMode] = useColorMode()
37
+ const isDark = colorMode === `dark`
38
+ // const toggleColorMode = e => {
39
+ // setColorMode(isDark ? `light` : `dark`)
40
+ // }
30
41
 
31
42
  const Map = () => {
32
43
  return (
@@ -34,7 +45,7 @@ const Layout = props => {
34
45
  defaultZoom={10}
35
46
  defaultCenter={{ lat: 51.0486, lng: -114.0708 }}
36
47
  defaultOptions={{
37
- styles: jsonMapStyles,
48
+ styles: isDark ? jsonMapStylesDark : jsonMapStyles,
38
49
  disableDefaultUI: true,
39
50
  zoomControl: false,
40
51
  scaleControl: false,
@@ -55,75 +66,105 @@ const Layout = props => {
55
66
  <Global
56
67
  styles={{
57
68
  "*": {
58
- boxSizing: "border-box",
59
- },
60
- body: {
61
- margin: 0,
69
+ boxSizing: `inherit`,
70
+ "&:before": {
71
+ boxSizing: `inherit`,
72
+ },
73
+ "&:after": {
74
+ boxSizing: `inherit`,
75
+ },
62
76
  },
77
+ body: { margin: 0 },
63
78
  html: {
79
+ fontSize: `16px`,
80
+ boxSizing: `border-box`,
64
81
  WebkitFontSmoothing: `antialiased`,
65
82
  MozOsxFontSmoothing: `grayscale`,
66
83
  },
67
84
  ".mapElement > div": {
68
85
  backgroundColor: "transparent !important",
69
86
  },
70
- ".headroom": {
71
- top: 0,
72
- left: 0,
73
- right: 0,
74
- zIndex: 1,
75
- },
76
- ".headroom--unfixed": {
77
- position: `relative`,
78
- transform: `translateY(0)`,
79
- },
80
- ".headroom--scrolled": {
81
- transition: `transform 200ms ease-in-out`,
82
- },
83
- ".headroom--unpinned": {
84
- position: `fixed`,
85
- transform: `translateY(-100%)`,
86
- },
87
- ".headroom--pinned": {
88
- position: `fixed`,
89
- transform: `translateY(0%)`,
90
- borderBottom: `1px solid transparent`,
91
- ...props.headRoomStyles,
92
- },
93
87
  }}
94
88
  />
95
89
 
96
- <Headroom disableInlineStyles={true}>
97
- <Header styles={props.headerStyles} />
98
- </Headroom>
90
+ <Header
91
+ styles={props.header}
92
+ setColorMode={setColorMode}
93
+ isDark={isDark}
94
+ menuOpen={menuOpen}
95
+ setMenuOpen={setMenuOpen}
96
+ nav={nav}
97
+ />
99
98
 
100
99
  <Main>
100
+ <div
101
+ ref={nav}
102
+ onFocus={e => {
103
+ setMenuOpen(true)
104
+ }}
105
+ onBlur={e => {
106
+ setMenuOpen(false)
107
+ }}
108
+ onClick={e => {
109
+ setMenuOpen(false)
110
+ }}
111
+ >
112
+ <Sidebar
113
+ open={menuOpen}
114
+ sx={{
115
+ display: [null, "none"],
116
+ }}
117
+ />
118
+ </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
+
101
134
  <div
102
135
  sx={{
103
- ...props.mainStyles,
136
+ ...props.main,
104
137
  }}
105
138
  >
106
- <Container>{props.children}</Container>
139
+ {props.children}
107
140
  </div>
108
141
  </Main>
109
142
 
110
- <WrapperMap
111
- googleMapURL={`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=AIzaSyBOY0sT1quks122bprrLM_0wrWLDWyVnMQ`}
112
- loadingElement={<div sx={{ height: `350px` }} />}
113
- containerElement={
114
- <div sx={{ height: `350px`, backgroundColor: "#f8f9fa" }} />
115
- }
116
- mapElement={
117
- <div
118
- sx={{
119
- height: `100%`,
120
- }}
121
- className="mapElement"
122
- />
123
- }
124
- />
143
+ {/* <div sx={{ display: ["none", "initial"] }}>
144
+ <WrapperMap
145
+ googleMapURL={`https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places&key=AIzaSyBOY0sT1quks122bprrLM_0wrWLDWyVnMQ`}
146
+ loadingElement={<div sx={{ height: `350px` }} />}
147
+ containerElement={
148
+ <div
149
+ sx={{
150
+ height: `350px`,
151
+ backgroundColor: isDark ? "#333" : "#f8f9fa",
152
+ }}
153
+ />
154
+ }
155
+ mapElement={
156
+ <div
157
+ sx={{
158
+ height: `100%`,
159
+ }}
160
+ className="mapElement"
161
+ />
162
+ }
163
+ />
164
+ </div>*/}
125
165
 
126
166
  <Footer />
167
+ <MobileNavigation isDark={isDark} />
127
168
  </DefaultLayout>
128
169
  </Styled.root>
129
170
  )
@@ -0,0 +1,32 @@
1
+ const jsonMapStylesDark = [
2
+ {
3
+ stylers: [
4
+ {
5
+ hue: "#ff1a00",
6
+ },
7
+ {
8
+ invert_lightness: true,
9
+ },
10
+ {
11
+ saturation: -100,
12
+ },
13
+ {
14
+ lightness: 33,
15
+ },
16
+ {
17
+ gamma: 0.5,
18
+ },
19
+ ],
20
+ },
21
+ {
22
+ featureType: "water",
23
+ elementType: "geometry",
24
+ stylers: [
25
+ {
26
+ color: "#2D333C",
27
+ },
28
+ ],
29
+ },
30
+ ]
31
+
32
+ export default jsonMapStylesDark
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from 'theme-ui';
2
+ import React from "react"
3
+ import { jsx } from "theme-ui"
4
4
 
5
- const Burger = ({ size = '1.5rem' }) => (
5
+ const Burger = ({ size = "1.5rem" }) => (
6
6
  <svg
7
7
  xmlns="http://www.w3.org/2000/svg"
8
8
  width={size}
@@ -10,35 +10,37 @@ const Burger = ({ size = '1.5rem' }) => (
10
10
  fill="currentcolor"
11
11
  viewBox="0 0 24 24"
12
12
  sx={{
13
- display: 'block',
14
- margin: 0
13
+ display: "block",
14
+ margin: 0,
15
15
  }}
16
16
  >
17
17
  <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
18
18
  </svg>
19
- );
19
+ )
20
20
 
21
- export default props => (
22
- <button
23
- title="Toggle Menu"
24
- {...props}
25
- sx={{
26
- fontFamily: 'inherit',
27
- fontSize: 24,
28
- color: '#333',
29
- bg: 'transparent',
30
- p: 0,
31
- m: 0,
32
- border: 0,
33
- appearance: 'none',
34
- ':focus': {
35
- outline: '0'
36
- },
37
- '@media screen and (min-width: 40em)': {
38
- display: 'none'
39
- }
40
- }}
41
- >
42
- <Burger />
43
- </button>
44
- );
21
+ export default props => {
22
+ return (
23
+ <button
24
+ title="Toggle Menu"
25
+ {...props}
26
+ sx={{
27
+ fontFamily: "inherit",
28
+ fontSize: 24,
29
+ color: "text",
30
+ bg: "transparent",
31
+ p: 0,
32
+ m: 0,
33
+ border: 0,
34
+ appearance: "none",
35
+ ":focus": {
36
+ outline: "0",
37
+ },
38
+ "@media screen and (min-width: 768px)": {
39
+ display: "none",
40
+ },
41
+ }}
42
+ >
43
+ <Burger />
44
+ </button>
45
+ )
46
+ }
@@ -15,6 +15,8 @@ const styles = {
15
15
  lineHeight: "2rem",
16
16
  transition: `all .5s ease-in;`,
17
17
  "&.active": {
18
+ borderBottom: `1px solid transparent`,
19
+ borderColor: "secondary",
18
20
  color: "secondary",
19
21
  cursor: "default",
20
22
  },
@@ -0,0 +1,74 @@
1
+ import React from "react"
2
+ import { Link } from "gatsby"
3
+ import { css } from "@emotion/core"
4
+
5
+ import Icon from "./icon"
6
+
7
+ const MobileNavItem = ({ linkTo, label, icon, isDark }) => {
8
+ const linkStyles = css`
9
+ borderradius: 2;
10
+ color: ${isDark ? "white" : "#333"};
11
+ font-size: 0.75rem;
12
+ flex-shrink: 0;
13
+ line-height: 1;
14
+ width: 64;
15
+ text-decoration: none;
16
+ text-align: center;
17
+ padding: 0.75rem;
18
+ &:hover {
19
+ text-decoration: none;
20
+ }
21
+ `
22
+
23
+ return (
24
+ <Link
25
+ to={linkTo}
26
+ css={linkStyles}
27
+ partiallyActive={linkTo === "/" ? false : true}
28
+ activeStyle={{ color: isDark ? "pink" : `#2b6cb0` }}
29
+ >
30
+ <span>{icon}</span>
31
+ <div>{label}</div>
32
+ </Link>
33
+ )
34
+ }
35
+
36
+ const MobileNavigation = ({ isDark, menuList }) => (
37
+ <React.Fragment>
38
+ <div
39
+ css={css`
40
+ position: fixed;
41
+ display: flex;
42
+ justify-content: space-around;
43
+ bottom: 0;
44
+ left: 0;
45
+ right: 0;
46
+ z-index: 50;
47
+ border-top: 1px solid ${isDark ? "#333" : "#d4d4d5"};
48
+ background: ${isDark ? "#1b1c1d" : "white"};
49
+ height: 3.75rem;
50
+ padding-bottom: env(safe-area-inset-bottom);
51
+ @media (min-width: 640px) {
52
+ display: none;
53
+ }
54
+ `}
55
+ >
56
+ {menuList &&
57
+ menuList
58
+ .filter(({ node }) => node.mobile === true)
59
+ .map(({ node: { label, link, id } }) => {
60
+ return (
61
+ <MobileNavItem
62
+ key={id}
63
+ isDark={isDark}
64
+ linkTo={link}
65
+ label={label}
66
+ icon={<Icon label={label} />}
67
+ />
68
+ )
69
+ })}
70
+ </div>
71
+ </React.Fragment>
72
+ )
73
+
74
+ export default MobileNavigation
@@ -1,21 +1,20 @@
1
1
  import React from "react"
2
2
  import { Link } from "gatsby"
3
- import { Styled } from "theme-ui"
3
+ import { Styled, Container } from "theme-ui"
4
4
 
5
5
  const ProjectList = ({ projects }) => (
6
- <React.Fragment>
7
- <Styled.h1>City of Calgary Events</Styled.h1>
6
+ <Container>
7
+ <Styled.h1>Projects</Styled.h1>
8
8
  <Styled.ul>
9
9
  {projects.map(project => (
10
10
  <Styled.li key={project.id}>
11
11
  <Styled.a as={Link} to={project.slug}>
12
12
  {project.title}
13
13
  </Styled.a>
14
- <p>{project.dateTime}</p>
15
14
  </Styled.li>
16
15
  ))}
17
16
  </Styled.ul>
18
- </React.Fragment>
17
+ </Container>
19
18
  )
20
19
 
21
20
  export default ProjectList
@@ -1,25 +1,59 @@
1
1
  /** @jsx jsx */
2
2
  import React from "react"
3
- import { Styled, jsx } from "theme-ui"
3
+ import { Styled, jsx, Container } from "theme-ui"
4
4
  import { Link } from "gatsby"
5
+ import Img from "gatsby-image"
6
+ import { useSpring, animated } from "react-spring"
5
7
  import { FaArrowLeft } from "react-icons/fa"
6
8
 
7
- const Project = ({ title, address, notes }) => (
8
- <div>
9
- <div
10
- sx={{ py: "9rem", px: "3rem", marginTop: "12rem", marginBottom: "3rem" }}
11
- >
12
- <Styled.a as={Link} to="/projects/">
13
- <FaArrowLeft size={12} sx={{ marginRight: ".25rem" }} />
14
- Back to showcase
15
- </Styled.a>
9
+ const Project = data => {
10
+ const Image = animated(Img)
11
+ const titleProps = useSpring({
12
+ from: { opacity: 0, transform: "translate3d(0, -150px, 0)" },
13
+ to: { opacity: 1, transform: "translate3d(0, 0, 0)" },
14
+ })
16
15
 
17
- <Styled.h1>
18
- {title} - {address}
19
- </Styled.h1>
20
- <Styled.h6>{notes}</Styled.h6>
16
+ const imgProps = useSpring({
17
+ delay: 600,
18
+ from: { opacity: 0, transform: "translate3d(0, 0, 0)" },
19
+ to: { opacity: 1, transform: "translate3d(0, 0, 0)" },
20
+ })
21
+
22
+ return (
23
+ <div>
24
+ <Container sx={{ px: [0, 4], py: 0 }}>
25
+ <div
26
+ sx={{
27
+ py: "15rem",
28
+ px: ["1.5rem", "3rem"],
29
+ zIndex: "1",
30
+ position: "relative",
31
+ }}
32
+ >
33
+ <animated.div style={titleProps}>
34
+ <Styled.a as={Link} to="/projects/">
35
+ <FaArrowLeft size={12} sx={{ marginRight: ".25rem" }} />
36
+ Back to showcase
37
+ </Styled.a>
38
+ <Styled.h1>{data.title}</Styled.h1>
39
+ </animated.div>
40
+
41
+ <Image
42
+ fluid={data.hero.childImageSharp.fluid}
43
+ style={imgProps}
44
+ sx={{
45
+ position: "absolute !important",
46
+ top: "0",
47
+ left: "10vw",
48
+ right: "0",
49
+ bottom: "0",
50
+ zIndex: "-1",
51
+ }}
52
+ />
53
+ </div>
54
+ </Container>
21
55
  </div>
22
- </div>
23
- )
56
+ )
57
+ }
24
58
 
25
59
  export default Project
@@ -1,41 +1,32 @@
1
1
  /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx, Box } from 'theme-ui';
4
-
5
- import { MDXProvider } from '@mdx-js/react';
6
- import NavLink from './nav-link';
2
+ import React from "react"
3
+ import { jsx } from "theme-ui"
4
+ import { AccordionNav } from "@theme-ui/sidenav"
5
+ import NavLink from "./nav-link"
6
+ import MenuList from "../menu.mdx"
7
7
 
8
8
  const components = {
9
- a: NavLink
10
- };
9
+ wrapper: AccordionNav,
10
+ a: NavLink,
11
+ }
11
12
 
12
- export default React.forwardRef(({ fullwidth, ...props }, ref) => (
13
- <>
14
- {props.open ? (
15
- <Box
16
- {...props}
17
- ref={ref}
18
- sx={{
19
- display: 'block',
20
- position: 'fixed',
21
- top: 87,
22
- left: 0,
23
- bottom: 0,
24
- width: 256,
25
- px: 2,
26
- bg: 'background',
27
- transition: 'transform .2s ease-out',
28
- transform: props.open ? 'translateX(0)' : 'translateX(-100%)',
13
+ export default props => {
14
+ const Menu = props.menuList || MenuList
29
15
 
30
- ul: {
31
- listStyle: 'none',
32
- m: 0,
33
- p: 0
34
- }
35
- }}
36
- >
37
- <MDXProvider components={components}>Home</MDXProvider>
38
- </Box>
39
- ) : null}
40
- </>
41
- ));
16
+ return (
17
+ <Menu
18
+ {...props}
19
+ components={components}
20
+ sx={{
21
+ width: 256,
22
+ flex: "none",
23
+ px: 3,
24
+ pt: 3,
25
+ pb: 4,
26
+ mt: [60, 0],
27
+ zIndex: 10,
28
+ bg: "Menu",
29
+ }}
30
+ />
31
+ )
32
+ }
@@ -0,0 +1,28 @@
1
+ import theme from "@theme-ui/preset-tailwind"
2
+
3
+ export default {
4
+ ...theme.colors,
5
+ // primary: theme.colors.blue[5],
6
+ // primaryHover: theme.colors.blue[6],
7
+ mBg: `#f8f9fa`,
8
+ cBg: `#ffffff`,
9
+ sBg: `#e2e8f0`,
10
+ Menu: `#ffffff`,
11
+ MenuBorder: `rgb(212, 212, 213)`,
12
+ MainHero: `white`,
13
+ toggleIcon: `#777777`,
14
+ modes: {
15
+ dark: {
16
+ background: `#333333`,
17
+ text: `#ffffff`,
18
+ mBg: `#333333`,
19
+ cBg: `#333333`,
20
+ sBg: `#333333`,
21
+ Menu: `#1b1c1d`,
22
+ MenuBorder: `#1b1c1d`,
23
+ primary: theme.colors.pink[3],
24
+ MainHero: `#1b1c1d`,
25
+ toggleIcon: theme.colors.white,
26
+ },
27
+ },
28
+ }
@@ -1,13 +1,15 @@
1
1
  import merge from "deepmerge"
2
- import { bootstrap } from "@theme-ui/presets"
2
+ import tailwind from "@theme-ui/preset-tailwind"
3
3
  import styles from "./styles"
4
+ import colors from "./colors"
4
5
 
5
6
  const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray
6
7
 
7
8
  export default merge(
8
- bootstrap,
9
+ tailwind,
9
10
  {
10
- breakpoints: ["768px", "992px", "1200px"],
11
+ // breakpoints: ["768px", "992px", "1200px"],
12
+ breakpoints: ["768px", "1024px", "1280px"],
11
13
  initialColorMode: `light`,
12
14
  useCustomProperties: true,
13
15
  textStyles: {
@@ -17,30 +19,56 @@ export default merge(
17
19
  lineHeight: "heading",
18
20
  },
19
21
  },
20
- colors: {
21
- mBg: `#f8f9fa`,
22
- cBg: `#ffffff`,
23
- sBg: `#e2e8f0`,
24
- modes: {
25
- dark: {
26
- background: `#333333`,
27
- text: `#ffffff`,
28
- mBg: `#333333`,
29
- cBg: `#333333`,
30
- sBg: `#333333`,
31
- primary: `pink`,
32
- },
22
+ colors,
23
+ styles,
24
+ buttons: {
25
+ primary: {
26
+ ...tailwind.buttons.simple,
27
+ backgroundColor: `brand`,
28
+ outline: `none`,
29
+ "&:hover": { backgroundColor: `brandHover` },
30
+ },
31
+ secondary: {
32
+ ...tailwind.buttons.elevated,
33
+ outline: `none`,
34
+ color: `gray.8`,
35
+ },
36
+ basic: {
37
+ ...tailwind.buttons.outline,
38
+ outline: `none`,
39
+ borderColor: `brand`,
40
+ color: `brand`,
41
+ "&:hover": { backgroundColor: `brand`, color: `white` },
33
42
  },
34
43
  },
35
- project: {
44
+ inputs: {
36
45
  primary: {
37
- bg: "cBg",
46
+ ...tailwind.inputs.inline,
47
+ width: `full`,
48
+ caretColor: tailwind.colors.pink[6],
38
49
  },
39
50
  secondary: {
40
- bg: "sBg",
51
+ ...tailwind.inputs.shadow,
52
+ width: `full`,
53
+ },
54
+ },
55
+ alerts: {
56
+ error: {
57
+ borderRadius: `sm`,
58
+ bg: `red.1`,
59
+ // border: `1px solid ${tailwind.colors.red[8]}`,
60
+ boxShadow: `inset 0 0 0 1px ${
61
+ tailwind.colors.red[8]
62
+ }, 0 0 0 0 transparent`,
63
+ opacity: 0.7,
64
+ color: `red.8`,
65
+ px: `1rem`,
66
+ fontWeight: `medium`,
67
+ display: `flex`,
68
+ width: `100%`,
69
+ alignItems: `center`,
41
70
  },
42
71
  },
43
- styles,
44
72
  },
45
73
  { arrayMerge: overwriteMerge }
46
74
  )