@t2ca/gatsby-theme-showcase 1.0.0 → 1.0.1

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/gatsby-config.js CHANGED
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * See: https://www.gatsbyjs.org/docs/gatsby-config/
5
5
  */
6
+ const remarkPlugins = [require("remark-slug")]
6
7
 
7
8
  module.exports = ({ contentPath = "data", basePath = "/" }) => ({
8
9
  plugins: [
@@ -12,18 +13,39 @@ module.exports = ({ contentPath = "data", basePath = "/" }) => ({
12
13
  path: contentPath,
13
14
  },
14
15
  },
16
+ `gatsby-plugin-sharp`,
17
+ `gatsby-transformer-sharp`,
15
18
  {
16
- resolve: `gatsby-transformer-yaml`,
19
+ resolve: `gatsby-transformer-remark`,
17
20
  options: {
18
- // typeName: "",
21
+ plugins: [
22
+ {
23
+ resolve: `gatsby-remark-images`,
24
+ options: {
25
+ // It's important to specify the maxWidth (in pixels) of
26
+ // the content container as this plugin uses this as the
27
+ // base for generating different widths of each image.
28
+ maxWidth: 1200,
29
+ },
30
+ },
31
+ ],
19
32
  },
20
33
  },
34
+ `gatsby-transformer-yaml`,
35
+ // {
36
+ // resolve: `gatsby-transformer-json`,
37
+ // options: {
38
+ // typeName: "Event",
39
+ // },
40
+ // },
41
+ `gatsby-plugin-emotion`,
42
+ `gatsby-plugin-theme-ui`,
21
43
  {
22
- resolve: `gatsby-transformer-json`,
44
+ resolve: "gatsby-plugin-mdx",
23
45
  options: {
24
- typeName: "Project",
46
+ extensions: [".mdx", ".md"],
47
+ remarkPlugins,
25
48
  },
26
49
  },
27
- `gatsby-plugin-theme-ui`,
28
50
  ],
29
51
  })
package/gatsby-node.js CHANGED
@@ -11,18 +11,14 @@ exports.onPreBootstrap = ({ reporter }, options) => {
11
11
  }
12
12
 
13
13
  // 2. define the project type
14
- exports.sourceNodes = ({ actions }) => {
14
+ exports.createSchemaCustomization = ({ actions }) => {
15
15
  const { createTypes } = actions
16
16
 
17
17
  const typeDefs = `
18
- type Project implements Node @dontInfer {
18
+ type ProjectYaml implements Node @infer {
19
19
  id: ID!
20
- title: String!
21
- notes: String
22
- address: String
23
- date: Date @dateformat @proxy(from: "next_date")
24
- dateTime: Date! @dateformat @proxy(from: "next_date_times")
25
20
  slug: String!
21
+ date: Date @dateformat
26
22
  }
27
23
  `
28
24
  createTypes(typeDefs)
@@ -42,7 +38,7 @@ exports.createResolvers = ({ createResolvers }, options) => {
42
38
  }
43
39
 
44
40
  createResolvers({
45
- Project: {
41
+ ProjectYaml: {
46
42
  slug: {
47
43
  resolve: source => slugify(source.title),
48
44
  },
@@ -60,7 +56,7 @@ exports.createPages = async ({ actions, graphql, reporter }, options) => {
60
56
 
61
57
  const result = await graphql(`
62
58
  query {
63
- allProject(sort: { fields: date, order: ASC }) {
59
+ allProjectYaml(sort: { fields: slug, order: ASC }) {
64
60
  nodes {
65
61
  id
66
62
  slug
@@ -74,7 +70,7 @@ exports.createPages = async ({ actions, graphql, reporter }, options) => {
74
70
  return
75
71
  }
76
72
 
77
- const projects = result.data.allProject.nodes
73
+ const projects = result.data.allProjectYaml.nodes
78
74
 
79
75
  projects.forEach(project => {
80
76
  const slug = project.slug
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  // noop
2
2
  export { default as Layout } from "./src/components/layout"
3
- export { default as Tiles } from "./src/components/tiles"
3
+ export { default as Alert } from "./src/components/alert"
4
+ export { default as Card } from "./src/components/card"
5
+ export { default as Button } from "./src/components/button"
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@t2ca/gatsby-theme-showcase",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "devDependencies": {
7
- "@hot-loader/react-dom": "^16.8.6",
7
+ "@hot-loader/react-dom": "^16.9.0",
8
8
  "babel-eslint": "^10.0.2",
9
9
  "eslint": "^6.0.1",
10
10
  "eslint-config-prettier": "^6.0.0",
@@ -14,31 +14,45 @@
14
14
  "eslint-plugin-jsx-a11y": "^6.2.3",
15
15
  "eslint-plugin-prettier": "^3.1.0",
16
16
  "eslint-plugin-react": "^7.14.2",
17
- "eslint-plugin-react-hooks": "^1.6.1",
17
+ "eslint-plugin-react-hooks": "^2.0.0",
18
18
  "gatsby": "^2.13.3",
19
+ "gatsby-image": "^2.2.7",
20
+ "gatsby-plugin-sharp": "^2.2.9",
21
+ "gatsby-remark-images": "^3.1.7",
22
+ "gatsby-transformer-remark": "^2.6.10",
23
+ "gatsby-transformer-sharp": "^2.2.5",
19
24
  "prettier": "^1.18.2",
20
25
  "react": "^16.8.6",
21
26
  "react-dom": "^16.8.6"
22
27
  },
23
28
  "peerDependencies": {
24
29
  "gatsby": "^2.13.3",
25
- "react": "^16.8.6",
26
- "react-dom": "^16.8.6"
30
+ "react": "^16.9.0",
31
+ "react-dom": "^16.9.0"
27
32
  },
28
33
  "dependencies": {
29
34
  "@emotion/core": "^10.0.14",
30
- "@mdx-js/react": "^1.0.21",
31
- "@theme-ui/presets": "^0.2.5",
35
+ "@emotion/styled": "^10.0.17",
36
+ "@hot-loader/react-dom": "^16.9.0",
37
+ "@mdx-js/mdx": "^1.4.0",
38
+ "@mdx-js/react": "^1.4.0",
39
+ "@theme-ui/preset-bootstrap": "^0.2.25",
40
+ "@theme-ui/preset-tailwind": "^0.2.30",
41
+ "@theme-ui/sidenav": "^0.2.36",
32
42
  "@theme-ui/typography": "^0.2.5",
33
43
  "deepmerge": "^4.0.0",
34
- "gatsby-plugin-theme-ui": "^0.2.5",
44
+ "gatsby-plugin-emotion": "^4.1.2",
45
+ "gatsby-plugin-mdx": "^1.0.33",
46
+ "gatsby-plugin-theme-ui": "^0.2.29",
35
47
  "gatsby-source-filesystem": "^2.1.4",
36
48
  "gatsby-transformer-json": "^2.2.2",
37
49
  "gatsby-transformer-yaml": "^2.2.1",
38
50
  "react-google-maps": "^9.4.5",
39
51
  "react-headroom": "^2.2.8",
40
52
  "react-icons": "^3.7.0",
53
+ "react-spring": "^8.0.27",
41
54
  "react-switch": "^5.0.0",
55
+ "remark-slug": "^5.1.2",
42
56
  "theme-ui": "^0.2.5"
43
57
  },
44
58
  "scripts": {
@@ -0,0 +1,23 @@
1
+ /** @jsx jsx */
2
+ import React from "react"
3
+ import { jsx } from "theme-ui"
4
+ import { FaExclamationTriangle } from "react-icons/fa"
5
+
6
+ export default props => (
7
+ <div sx={{ variant: `alerts.error` }}>
8
+ <FaExclamationTriangle
9
+ size={40}
10
+ sx={{
11
+ flex: `0 0 auto`,
12
+ width: `auto`,
13
+ lineHeight: 1,
14
+ verticalAlign: `middle`,
15
+ fontSize: `3rem`,
16
+ }}
17
+ />
18
+ <div sx={{ pl: `1rem`, margin: `.5rem` }}>
19
+ <span sx={{ fontWeight: `extrabold` }}>Sorry, there was a problem.</span>
20
+ {props.children}
21
+ </div>
22
+ </div>
23
+ )
@@ -1,25 +1,12 @@
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
- export default props => (
5
+ export default ({ type = "basic", ...props }) => (
6
6
  <button
7
7
  {...props}
8
8
  sx={{
9
- appearance: 'none',
10
- fontFamily: 'inherit',
11
- fontSize: 1,
12
- fontWeight: 'bold',
13
- m: 0,
14
- px: 2,
15
- py: 2,
16
- color: 'text',
17
- bg: 'muted',
18
- border: 0,
19
- borderRadius: 2,
20
- ':focus': {
21
- outline: '2px solid'
22
- }
9
+ variant: `buttons.${type}`,
23
10
  }}
24
11
  />
25
- );
12
+ )
@@ -0,0 +1,23 @@
1
+ /** @jsx jsx */
2
+ import React from "react"
3
+ import { jsx, Styled } from "theme-ui"
4
+ import Button from "./button"
5
+
6
+ export default props => (
7
+ <Styled.li>
8
+ <Styled.h4
9
+ sx={{
10
+ svg: {
11
+ width: 5,
12
+ height: 5,
13
+ marginRight: `.5rem`,
14
+ },
15
+ }}
16
+ >
17
+ {props.icon}
18
+ {props.title}
19
+ </Styled.h4>
20
+ <p>{props.desc}</p>
21
+ <Button type={props.buttonType}>{props.button}</Button>
22
+ </Styled.li>
23
+ )
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import React from "react"
3
+ import { jsx, Styled } from "theme-ui"
4
+
5
+ export default ({ children }) => (
6
+ <div
7
+ sx={{
8
+ variant: `cards.primary`,
9
+ }}
10
+ >
11
+ <Styled.ul>{children}</Styled.ul>
12
+ </div>
13
+ )
@@ -0,0 +1,75 @@
1
+ /** @jsx jsx */
2
+ import React from "react"
3
+ import { jsx } from "theme-ui"
4
+
5
+ const ColorModeToggle = ({ isDark, toggle }) => (
6
+ <React.Fragment>
7
+ <button
8
+ onClick={toggle}
9
+ type="button"
10
+ aria-label={isDark ? `Light Mode` : `Dark Mode`}
11
+ title={isDark ? `Light Mode` : `Dark Mode`}
12
+ sx={{
13
+ opacity: 0.65,
14
+ position: `relative`,
15
+ borderRadius: `5px`,
16
+ // width: `40px`,
17
+ // height: `25px`,
18
+ display: `flex`,
19
+ alignItems: `center`,
20
+ justifyContent: `center`,
21
+ transition: `opacity 0.3s ease`,
22
+ border: `none`,
23
+ outline: `none`,
24
+ background: `none`,
25
+ cursor: `pointer`,
26
+ "&:hover, &:focus": { opacity: 1 },
27
+ }}
28
+ >
29
+ <div
30
+ sx={{
31
+ position: `relative`,
32
+ width: `24px`,
33
+ height: `24px`,
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
+ )
74
+
75
+ export default ColorModeToggle
@@ -1,49 +1,29 @@
1
1
  /** @jsx jsx */
2
2
  import React from "react"
3
3
  import { Link } from "gatsby"
4
- import { jsx, Header, Container, useColorMode } from "theme-ui"
4
+ import { jsx, Header, Container } from "theme-ui"
5
+
6
+ import MenuButton from "./menu-button"
5
7
  import NavLink from "./nav-link"
6
- import Switch from "./switch"
7
- import sun from "../assets/sun.png"
8
- import moon from "../assets/moon.png"
8
+ import ColorModeToggle from "./color-mode-toggle"
9
9
 
10
- export default props => {
11
- const [colorMode, setColorMode] = useColorMode()
12
- const isDark = colorMode === `dark`
10
+ export default ({
11
+ setColorMode,
12
+ setMenuOpen,
13
+ isDark,
14
+ styles,
15
+ menuOpen,
16
+ nav,
17
+ name,
18
+ menuList,
19
+ }) => {
13
20
  const toggleColorMode = e => {
21
+ e.preventDefault()
14
22
  setColorMode(isDark ? `light` : `dark`)
15
23
  }
16
24
 
17
- const checkedIcon = (
18
- <img
19
- alt="moon indicating dark mode"
20
- src={moon}
21
- width="16"
22
- height="16"
23
- role="presentation"
24
- css={{
25
- pointerEvents: `none`,
26
- margin: 4,
27
- }}
28
- />
29
- )
30
-
31
- const uncheckedIcon = (
32
- <img
33
- alt="sun indicating light mode"
34
- src={sun}
35
- width="16"
36
- height="16"
37
- role="presentation"
38
- css={{
39
- pointerEvents: `none`,
40
- margin: 4,
41
- }}
42
- />
43
- )
44
-
45
25
  return (
46
- <Header sx={{ ...props.styles }}>
26
+ <Header sx={{ ...styles }}>
47
27
  <Container sx={{ py: 0 }}>
48
28
  <div
49
29
  sx={{
@@ -52,9 +32,25 @@ export default props => {
52
32
  alignItems: `center`,
53
33
  }}
54
34
  >
35
+ <MenuButton
36
+ disabled={menuOpen}
37
+ onClick={e => {
38
+ setMenuOpen(!menuOpen)
39
+ // if (!props.menuOpen) return props.setMenuOpen(!props.menuOpen)
40
+ if (!nav.current) return
41
+ const navLink = nav.current.querySelector("a")
42
+ if (navLink) navLink.focus()
43
+ }}
44
+ />
55
45
  <Link to="/" sx={{ color: "inherit", textDecoration: "none" }}>
56
- <span sx={{ fontSize: [`1.25rem`, `1.5rem`], fontWeight: 600 }}>
57
- {props.name}
46
+ <span
47
+ sx={{
48
+ fontSize: [`1.25rem`, `1.5rem`],
49
+ fontWeight: 600,
50
+ color: "brand",
51
+ }}
52
+ >
53
+ {name}
58
54
  </span>
59
55
  </Link>
60
56
  <div
@@ -67,21 +63,16 @@ export default props => {
67
63
  height: 59,
68
64
  }}
69
65
  >
70
- <div sx={{ display: ["none", "initial"] }}>
71
- <NavLink to="/projects/">Showcase</NavLink>
72
- <NavLink to="/about/">About</NavLink>
73
- <NavLink to="/contact/" sx={{ marginRight: "3rem" }}>
74
- Contact
75
- </NavLink>
66
+ <div sx={{ display: ["none", "inherit"] }}>
67
+ {menuList &&
68
+ menuList.map(({ node: { label, link, id } }) => (
69
+ <NavLink key={id} to={link}>
70
+ {label}
71
+ </NavLink>
72
+ ))}
76
73
  </div>
77
74
 
78
- <Switch
79
- aria-label="Toggle dark mode"
80
- checkedIcon={checkedIcon}
81
- uncheckedIcon={uncheckedIcon}
82
- checked={isDark}
83
- onChange={toggleColorMode}
84
- />
75
+ <ColorModeToggle isDark={isDark} toggle={toggleColorMode} />
85
76
  </div>
86
77
  </div>
87
78
  </Container>
@@ -0,0 +1,61 @@
1
+ /** @jsx jsx */
2
+ import React from "react"
3
+ import { jsx, Styled, Container } from "theme-ui"
4
+ import { useSpring, animated } from "react-spring"
5
+
6
+ export default props => {
7
+ const titleProps = useSpring({
8
+ from: { opacity: 0, transform: "translate3d(0, -200px, 0)" },
9
+ to: { opacity: 1, transform: "translate3d(0, 0, 0)" },
10
+ })
11
+
12
+ return (
13
+ <React.Fragment>
14
+ <div
15
+ sx={{
16
+ py: "9rem",
17
+ px: ["1.5rem", "3rem"],
18
+ position: "relative",
19
+ bg: `MainHero`,
20
+ minHeight: `80vh`,
21
+ }}
22
+ >
23
+ <Container>
24
+ <animated.div style={titleProps}>
25
+ <Styled.h1 sx={{ fontSize: [6, 7] }}>{props.headingTop}</Styled.h1>
26
+ <Styled.h1 sx={{ fontSize: [6, 7] }}>
27
+ {props.headingMiddle}
28
+ </Styled.h1>
29
+ <Styled.h1 sx={{ fontSize: [6, 7] }}>
30
+ {props.headingBottom}
31
+ </Styled.h1>
32
+ </animated.div>
33
+ </Container>
34
+ </div>
35
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 200">
36
+ <path
37
+ fill={props.isDark ? "#1b1c1d" : "#ffffff"}
38
+ d="M0,96L40,112C80,128,160,160,240,170.7C320,181,400,171,480,160C560,149,640,139,720,112C800,85,880,43,960,37.3C1040,32,1120,64,1200,96C1280,128,1360,160,1400,176L1440,192L1440,0L1400,0C1360,0,1280,0,1200,0C1120,0,1040,0,960,0C880,0,800,0,720,0C640,0,560,0,480,0C400,0,320,0,240,0C160,0,80,0,40,0L0,0Z"
39
+ ></path>
40
+ <g transform="translate(0.000000, 44.000000)">
41
+ <path
42
+ fill={props.isDark ? "#777777" : props.color}
43
+ d="M0,0 C90.7283404,0.927527913 147.912752,27.187927 291.910178,59.9119003 C387.908462,81.7278826 543.605069,89.334785 759,82.7326078 C469.336065,156.254352 216.336065,153.6679 0,74.9732496"
44
+ opacity="0.100000001"
45
+ ></path>
46
+ <path
47
+ fill={props.isDark ? "#999999" : props.color}
48
+ d="M100,104.708498 C277.413333,72.2345949 426.147877,52.5246657 546.203633,45.5787101 C666.259389,38.6327546 810.524845,41.7979068 979,55.0741668 C931.069965,56.122511 810.303266,74.8455141 616.699903,111.243176 C423.096539,147.640838 250.863238,145.462612 100,104.708498 Z"
49
+ opacity="0.100000001"
50
+ ></path>
51
+ <path
52
+ fill={props.isDark ? "#555555" : props.color}
53
+ d="M920,51.6521276 C1130.83045,29.328812 1279.08318,17.607883 1439,40.1656806 L1439,120 C1271.17211,77.9435312 1140.17211,55.1609071 1046,51.6521276 Z"
54
+ id="Path-4"
55
+ opacity="0.200000003"
56
+ ></path>
57
+ </g>
58
+ </svg>
59
+ </React.Fragment>
60
+ )
61
+ }
@@ -0,0 +1,15 @@
1
+ import React from "react"
2
+
3
+ import { FiLayout, FiEdit, FiPhone, FiHome, FiLayers } from "react-icons/fi"
4
+
5
+ const reactIcons = {
6
+ Home: <FiHome size={20} />,
7
+ "Web Design": <FiLayout size={20} />,
8
+ Showcase: <FiLayers size={20} />,
9
+ Quote: <FiEdit size={20} />,
10
+ Contact: <FiPhone size={20} />,
11
+ }
12
+
13
+ const Icon = ({ label }) => reactIcons[label]
14
+
15
+ export default Icon