@t2ca/gatsby-theme-showcase 1.1.4 → 1.2.0
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 +6 -9
- package/gatsby-node.js +13 -85
- package/package.json +8 -8
- package/src/components/layout.js +2 -2
- package/src/components/project-list.js +0 -20
- package/src/components/project.js +0 -69
- package/src/menu.mdx +0 -1
- package/src/templates/project.js +0 -43
- package/src/templates/projects.js +0 -34
package/gatsby-config.js
CHANGED
|
@@ -4,17 +4,19 @@
|
|
|
4
4
|
* See: https://www.gatsbyjs.org/docs/gatsby-config/
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
module.exports =
|
|
7
|
+
module.exports = {
|
|
8
8
|
plugins: [
|
|
9
9
|
{
|
|
10
10
|
resolve: `gatsby-source-filesystem`,
|
|
11
11
|
options: {
|
|
12
|
-
|
|
12
|
+
name: `content`,
|
|
13
|
+
path: `content`,
|
|
13
14
|
},
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
17
|
resolve: `gatsby-source-filesystem`,
|
|
17
18
|
options: {
|
|
19
|
+
name: `assets`,
|
|
18
20
|
path: "./src/assets",
|
|
19
21
|
},
|
|
20
22
|
},
|
|
@@ -37,13 +39,8 @@ module.exports = ({ contentPath = "data", basePath = "/" }) => ({
|
|
|
37
39
|
},
|
|
38
40
|
},
|
|
39
41
|
`gatsby-transformer-yaml`,
|
|
40
|
-
|
|
41
|
-
// resolve: `gatsby-transformer-json`,
|
|
42
|
-
// options: {
|
|
43
|
-
// typeName: "Event",
|
|
44
|
-
// },
|
|
45
|
-
// },
|
|
42
|
+
`gatsby-transformer-json`,
|
|
46
43
|
`gatsby-plugin-react-helmet`,
|
|
47
44
|
`gatsby-plugin-theme-ui`,
|
|
48
45
|
],
|
|
49
|
-
}
|
|
46
|
+
}
|
package/gatsby-node.js
CHANGED
|
@@ -1,87 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// 2. define the project type
|
|
14
|
-
exports.createSchemaCustomization = ({ actions }) => {
|
|
15
|
-
const { createTypes } = actions
|
|
16
|
-
|
|
17
|
-
const typeDefs = `
|
|
18
|
-
type ProjectsYaml implements Node @infer {
|
|
19
|
-
id: ID!
|
|
20
|
-
slug: String!
|
|
21
|
-
date: Date @dateformat
|
|
22
|
-
}
|
|
23
|
-
`
|
|
24
|
-
createTypes(typeDefs)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 3. define resolvers for any custom fields (slug)
|
|
28
|
-
exports.createResolvers = ({ createResolvers }, options) => {
|
|
29
|
-
const basePath = options.basePath || "/"
|
|
30
|
-
|
|
31
|
-
const slugify = (str) => {
|
|
32
|
-
const slug = str
|
|
33
|
-
.toLowerCase()
|
|
34
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
35
|
-
.replace(/(^-|-$)+/g, "")
|
|
36
|
-
|
|
37
|
-
return `/${basePath}/${slug}/`.replace(/\/\/+/g, "/")
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
createResolvers({
|
|
41
|
-
ProjectsYaml: {
|
|
42
|
-
slug: {
|
|
43
|
-
resolve: (source) => slugify(source.title),
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 4. query for projects and create pages
|
|
50
|
-
exports.createPages = async ({ actions, graphql, reporter }, options) => {
|
|
51
|
-
const basePath = options.basePath || "/"
|
|
52
|
-
actions.createPage({
|
|
53
|
-
path: basePath,
|
|
54
|
-
component: require.resolve("./src/templates/projects.js"),
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const result = await graphql(`
|
|
58
|
-
query {
|
|
59
|
-
allProjectsYaml(sort: { fields: slug, order: ASC }) {
|
|
60
|
-
nodes {
|
|
61
|
-
id
|
|
62
|
-
slug
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
`)
|
|
67
|
-
|
|
68
|
-
if (result.errors) {
|
|
69
|
-
reporter.panic("error loading projects", reporter.errors)
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const projects = result.data.allProjectsYaml.nodes
|
|
74
|
-
|
|
75
|
-
projects.forEach((project) => {
|
|
76
|
-
const slug = project.slug
|
|
77
|
-
|
|
78
|
-
actions.createPage({
|
|
79
|
-
path: slug,
|
|
80
|
-
component: require.resolve("./src/templates/project.js"),
|
|
81
|
-
context: {
|
|
82
|
-
slug: project.slug,
|
|
83
|
-
projectID: project.id,
|
|
84
|
-
},
|
|
1
|
+
/**
|
|
2
|
+
* Implement Gatsby's Node APIs in this file.
|
|
3
|
+
*
|
|
4
|
+
* See: https://www.gatsbyjs.com/docs/node-apis/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// You can delete this file if you're not using it
|
|
8
|
+
|
|
9
|
+
exports.onCreateWebpackConfig = ({ stage, actions }) => {
|
|
10
|
+
if (stage === `build-javascript`) {
|
|
11
|
+
actions.setWebpackConfig({
|
|
12
|
+
devtool: false,
|
|
85
13
|
})
|
|
86
|
-
}
|
|
14
|
+
}
|
|
87
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t2ca/gatsby-theme-showcase",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"devDependencies": {
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"react-dom": "^17.0.1"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@theme-ui/components": "^0.
|
|
26
|
-
"@theme-ui/preset-bootstrap": "^0.
|
|
27
|
-
"@theme-ui/preset-tailwind": "^0.
|
|
28
|
-
"@theme-ui/sidenav": "^0.
|
|
29
|
-
"@theme-ui/typography": "^0.
|
|
25
|
+
"@theme-ui/components": "^0.9.1",
|
|
26
|
+
"@theme-ui/preset-bootstrap": "^0.9.1",
|
|
27
|
+
"@theme-ui/preset-tailwind": "^0.9.1",
|
|
28
|
+
"@theme-ui/sidenav": "^0.9.1",
|
|
29
|
+
"@theme-ui/typography": "^0.9.1",
|
|
30
30
|
"framer-motion": "^4.0.0",
|
|
31
31
|
"gatsby": "^3.2.0",
|
|
32
32
|
"gatsby-image": "^3.0.0",
|
|
33
33
|
"gatsby-plugin-react-helmet": "^4.0.0",
|
|
34
34
|
"gatsby-plugin-sharp": "^3.0.0",
|
|
35
|
-
"gatsby-plugin-theme-ui": "^0.
|
|
35
|
+
"gatsby-plugin-theme-ui": "^0.9.1",
|
|
36
36
|
"gatsby-remark-images": "^5.0.0",
|
|
37
37
|
"gatsby-source-filesystem": "^3.0.0",
|
|
38
38
|
"gatsby-transformer-json": "^3.0.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"gatsby-transformer-yaml": "^3.0.0",
|
|
42
42
|
"react-helmet": "^6.0.0",
|
|
43
43
|
"react-icons": "^4.1.0",
|
|
44
|
-
"theme-ui": "^0.
|
|
44
|
+
"theme-ui": "^0.9.1",
|
|
45
45
|
"yup": "^0.32.8"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
package/src/components/layout.js
CHANGED
|
@@ -33,13 +33,13 @@ const Layout = ({ noBorder, children }) => {
|
|
|
33
33
|
<Sidebar open={menuOpen} isAlert={isAlert} />
|
|
34
34
|
|
|
35
35
|
{!hasMounted ? null : (
|
|
36
|
-
<
|
|
36
|
+
<main
|
|
37
37
|
sx={{
|
|
38
38
|
pt: isAlert ? `6.875rem` : `4.25rem`,
|
|
39
39
|
}}
|
|
40
40
|
>
|
|
41
41
|
{children}
|
|
42
|
-
</
|
|
42
|
+
</main>
|
|
43
43
|
)}
|
|
44
44
|
|
|
45
45
|
<Footer />
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { Link } from "gatsby"
|
|
3
|
-
import { Themed, Container } from "theme-ui"
|
|
4
|
-
|
|
5
|
-
const ProjectList = ({ projects }) => (
|
|
6
|
-
<Container>
|
|
7
|
-
<Themed.h1>Projects</Themed.h1>
|
|
8
|
-
<Themed.ul>
|
|
9
|
-
{projects.map((project) => (
|
|
10
|
-
<Themed.li key={project.id}>
|
|
11
|
-
<Themed.a as={Link} to={project.slug}>
|
|
12
|
-
{project.title}
|
|
13
|
-
</Themed.a>
|
|
14
|
-
</Themed.li>
|
|
15
|
-
))}
|
|
16
|
-
</Themed.ul>
|
|
17
|
-
</Container>
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
export default ProjectList
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import React from "react"
|
|
3
|
-
import { Themed, jsx, Container } from "theme-ui"
|
|
4
|
-
import { Link } from "gatsby"
|
|
5
|
-
import Img from "gatsby-image"
|
|
6
|
-
|
|
7
|
-
import { motion } from "framer-motion"
|
|
8
|
-
import { FaArrowLeft } from "react-icons/fa"
|
|
9
|
-
import Wave from "./wave"
|
|
10
|
-
|
|
11
|
-
const Project = (data) => {
|
|
12
|
-
return (
|
|
13
|
-
<React.Fragment>
|
|
14
|
-
<Container sx={{ px: [0, 0, 4], py: 0 }}>
|
|
15
|
-
<div
|
|
16
|
-
sx={{
|
|
17
|
-
py: "15rem",
|
|
18
|
-
px: ["1.5rem", "1.5rem", "3rem"],
|
|
19
|
-
zIndex: "1",
|
|
20
|
-
position: "relative",
|
|
21
|
-
minHeight: `75vh`, // screenHeight
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
<motion.div
|
|
25
|
-
initial={{ opacity: 0, y: -150 }}
|
|
26
|
-
animate={{ opacity: 1, y: 0 }}
|
|
27
|
-
transition={{ duration: 0.5 }}
|
|
28
|
-
>
|
|
29
|
-
<Themed.a as={Link} to="/projects/">
|
|
30
|
-
<FaArrowLeft size={12} sx={{ marginRight: ".25rem" }} />
|
|
31
|
-
Back to showcase
|
|
32
|
-
</Themed.a>
|
|
33
|
-
<Themed.h1>{data.title}</Themed.h1>
|
|
34
|
-
</motion.div>
|
|
35
|
-
|
|
36
|
-
<motion.div
|
|
37
|
-
initial={{ opacity: 0, y: 0 }}
|
|
38
|
-
animate={{ opacity: 1, y: 0 }}
|
|
39
|
-
transition={{ delay: 0.5 }}
|
|
40
|
-
>
|
|
41
|
-
<Img
|
|
42
|
-
fluid={data.hero.childImageSharp.fluid}
|
|
43
|
-
sx={{
|
|
44
|
-
position: "absolute !important",
|
|
45
|
-
top: "0",
|
|
46
|
-
left: "10vw",
|
|
47
|
-
right: "0",
|
|
48
|
-
bottom: "0",
|
|
49
|
-
zIndex: "-1",
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
</motion.div>
|
|
53
|
-
</div>
|
|
54
|
-
</Container>
|
|
55
|
-
|
|
56
|
-
<Wave background="cBg" />
|
|
57
|
-
|
|
58
|
-
<div sx={{ bg: `mBg` }}>
|
|
59
|
-
<Container>
|
|
60
|
-
<div sx={{ width: `2/3`, m: `0 auto` }}>
|
|
61
|
-
<Img fluid={data.laptop.childImageSharp.fluid} sx={{}} />
|
|
62
|
-
</div>
|
|
63
|
-
</Container>
|
|
64
|
-
</div>
|
|
65
|
-
</React.Fragment>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default Project
|
package/src/menu.mdx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
- [Showcase](/projects/)
|
package/src/templates/project.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { graphql } from "gatsby"
|
|
3
|
-
import Layout from "../components/layout"
|
|
4
|
-
import Project from "../components/project"
|
|
5
|
-
|
|
6
|
-
const ProjectTemplates = ({ data: { projectsYaml } }) => {
|
|
7
|
-
const styles = {
|
|
8
|
-
variant: "styles.Header.secondary",
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<Layout main={{ ...styles, borderBottom: `inherit` }} header={styles}>
|
|
13
|
-
<Project {...projectsYaml} />
|
|
14
|
-
</Layout>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default ProjectTemplates
|
|
19
|
-
|
|
20
|
-
export const query = graphql`
|
|
21
|
-
query($projectID: String!) {
|
|
22
|
-
projectsYaml(id: { eq: $projectID }) {
|
|
23
|
-
title
|
|
24
|
-
url
|
|
25
|
-
body
|
|
26
|
-
date
|
|
27
|
-
hero {
|
|
28
|
-
childImageSharp {
|
|
29
|
-
fluid(cropFocus: ENTROPY, maxWidth: 1200, quality: 90) {
|
|
30
|
-
...GatsbyImageSharpFluid_withWebp_tracedSVG
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
laptop {
|
|
35
|
-
childImageSharp {
|
|
36
|
-
fluid(cropFocus: ENTROPY, maxWidth: 1200) {
|
|
37
|
-
...GatsbyImageSharpFluid_withWebp_tracedSVG
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { graphql, useStaticQuery } from "gatsby"
|
|
3
|
-
import Layout from "../components/layout"
|
|
4
|
-
import ProjectList from "../components/project-list"
|
|
5
|
-
|
|
6
|
-
const ProjectsTemplates = (props) => {
|
|
7
|
-
const data = useStaticQuery(graphql`
|
|
8
|
-
query {
|
|
9
|
-
allProjectsYaml(sort: { fields: slug, order: ASC }) {
|
|
10
|
-
nodes {
|
|
11
|
-
id
|
|
12
|
-
title
|
|
13
|
-
slug
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`)
|
|
18
|
-
|
|
19
|
-
const projects = data.allProjectsYaml.nodes
|
|
20
|
-
|
|
21
|
-
const styles = {
|
|
22
|
-
bg: `Menu`,
|
|
23
|
-
borderBottom: `1px solid transparent`,
|
|
24
|
-
borderColor: `MenuBorder`,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<Layout header={styles} location={props.location}>
|
|
29
|
-
<ProjectList projects={projects} />
|
|
30
|
-
</Layout>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default ProjectsTemplates
|