@t2ca/gatsby-theme-showcase 1.0.59 → 1.0.61
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-node.js +7 -7
- package/package.json +1 -1
- package/src/components/sidebar.js +13 -14
- package/src/templates/project.js +1 -1
- package/src/templates/projects.js +3 -3
package/gatsby-node.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.createSchemaCustomization = ({ actions }) => {
|
|
|
15
15
|
const { createTypes } = actions
|
|
16
16
|
|
|
17
17
|
const typeDefs = `
|
|
18
|
-
type
|
|
18
|
+
type ProjectsYaml implements Node @infer {
|
|
19
19
|
id: ID!
|
|
20
20
|
slug: String!
|
|
21
21
|
date: Date @dateformat
|
|
@@ -28,7 +28,7 @@ exports.createSchemaCustomization = ({ actions }) => {
|
|
|
28
28
|
exports.createResolvers = ({ createResolvers }, options) => {
|
|
29
29
|
const basePath = options.basePath || "/"
|
|
30
30
|
|
|
31
|
-
const slugify = str => {
|
|
31
|
+
const slugify = (str) => {
|
|
32
32
|
const slug = str
|
|
33
33
|
.toLowerCase()
|
|
34
34
|
.replace(/[^a-z0-9]+/g, "-")
|
|
@@ -38,9 +38,9 @@ exports.createResolvers = ({ createResolvers }, options) => {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
createResolvers({
|
|
41
|
-
|
|
41
|
+
ProjectsYaml: {
|
|
42
42
|
slug: {
|
|
43
|
-
resolve: source => slugify(source.title),
|
|
43
|
+
resolve: (source) => slugify(source.title),
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
46
|
})
|
|
@@ -56,7 +56,7 @@ exports.createPages = async ({ actions, graphql, reporter }, options) => {
|
|
|
56
56
|
|
|
57
57
|
const result = await graphql(`
|
|
58
58
|
query {
|
|
59
|
-
|
|
59
|
+
allProjectsYaml(sort: { fields: slug, order: ASC }) {
|
|
60
60
|
nodes {
|
|
61
61
|
id
|
|
62
62
|
slug
|
|
@@ -70,9 +70,9 @@ exports.createPages = async ({ actions, graphql, reporter }, options) => {
|
|
|
70
70
|
return
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
const projects = result.data.
|
|
73
|
+
const projects = result.data.allProjectsYaml.nodes
|
|
74
74
|
|
|
75
|
-
projects.forEach(project => {
|
|
75
|
+
projects.forEach((project) => {
|
|
76
76
|
const slug = project.slug
|
|
77
77
|
|
|
78
78
|
actions.createPage({
|
package/package.json
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import React from "react"
|
|
3
2
|
import { jsx } from "theme-ui"
|
|
4
|
-
import {
|
|
3
|
+
import { Sidenav } from "@theme-ui/sidenav"
|
|
5
4
|
import NavLink from "./nav-link"
|
|
6
|
-
import MenuList from "../menu.mdx"
|
|
7
|
-
|
|
8
|
-
const components = {
|
|
9
|
-
wrapper: AccordionNav,
|
|
10
|
-
a: NavLink,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default ({ menuList, open }) => {
|
|
14
|
-
const Menu = menuList || MenuList
|
|
15
5
|
|
|
6
|
+
export default ({ menuLinks, open }) => {
|
|
16
7
|
return (
|
|
17
|
-
<
|
|
18
|
-
components={components}
|
|
8
|
+
<Sidenav
|
|
19
9
|
sx={{
|
|
20
10
|
px: 3,
|
|
21
11
|
pt: 3,
|
|
@@ -29,6 +19,15 @@ export default ({ menuList, open }) => {
|
|
|
29
19
|
transform: [open ? "translateX(0)" : "translate(-100%) !important"],
|
|
30
20
|
zIndex: 10,
|
|
31
21
|
}}
|
|
32
|
-
|
|
22
|
+
>
|
|
23
|
+
<ul sx={{ listStyle: `none`, p: 0, m: 0 }}>
|
|
24
|
+
{menuLinks &&
|
|
25
|
+
menuLinks.map(({ node: { label, link, id } }) => (
|
|
26
|
+
<li key={id}>
|
|
27
|
+
<NavLink to={link}>{label}</NavLink>
|
|
28
|
+
</li>
|
|
29
|
+
))}
|
|
30
|
+
</ul>
|
|
31
|
+
</Sidenav>
|
|
33
32
|
)
|
|
34
33
|
}
|
package/src/templates/project.js
CHANGED
|
@@ -3,10 +3,10 @@ import { graphql, useStaticQuery } from "gatsby"
|
|
|
3
3
|
import Layout from "../components/layout"
|
|
4
4
|
import ProjectList from "../components/project-list"
|
|
5
5
|
|
|
6
|
-
const ProjectsTemplates = props => {
|
|
6
|
+
const ProjectsTemplates = (props) => {
|
|
7
7
|
const data = useStaticQuery(graphql`
|
|
8
8
|
query {
|
|
9
|
-
|
|
9
|
+
allProjectsYaml(sort: { fields: slug, order: ASC }) {
|
|
10
10
|
nodes {
|
|
11
11
|
id
|
|
12
12
|
title
|
|
@@ -16,7 +16,7 @@ const ProjectsTemplates = props => {
|
|
|
16
16
|
}
|
|
17
17
|
`)
|
|
18
18
|
|
|
19
|
-
const projects = data.
|
|
19
|
+
const projects = data.allProjectsYaml.nodes
|
|
20
20
|
|
|
21
21
|
const styles = {
|
|
22
22
|
bg: `Menu`,
|