Skip to content

Commit

Permalink
refractor(www): Use nodes in gatsbyjs.org code instead of edges.node
Browse files Browse the repository at this point in the history
  • Loading branch information
b0nbon1 committed Feb 28, 2020
1 parent f585eb0 commit 8a90c53
Show file tree
Hide file tree
Showing 31 changed files with 343 additions and 405 deletions.
26 changes: 12 additions & 14 deletions www/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,21 +287,19 @@ module.exports = {
fileAbsolutePath: { regex: "/docs.blog/" }
}
) {
edges {
node {
html
frontmatter {
title
date
author {
id
}
}
fields {
excerpt
slug
nodes {
html
frontmatter {
title
date
author {
id
}
}
fields {
excerpt
slug
}
}
}
}
Expand All @@ -321,7 +319,7 @@ module.exports = {
}
},
serialize: ({ query: { site, allMdx } }) =>
allMdx.edges.map(({ node }) => {
allMdx.nodes.map(node => {
return {
title: node.frontmatter.title,
description: node.fields.excerpt,
Expand Down
12 changes: 5 additions & 7 deletions www/src/components/diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,14 @@ const Diagram = () => (
query={graphql`
query StaticHostsQuery {
allStaticHostsYaml {
edges {
node {
title
url
}
nodes {
title
url
}
}
}
`}
render={({ allStaticHostsYaml: { edges: staticHosts } }) => (
render={({ allStaticHostsYaml: { nodes: staticHosts } }) => (
<section
className="Diagram"
sx={{
Expand Down Expand Up @@ -308,7 +306,7 @@ const Diagram = () => (
>
<ItemTitle>Web Hosting</ItemTitle>
<ItemDescription>
{staticHosts.map(({ node: staticHost }, index) => (
{staticHosts.map((staticHost, index) => (
<Fragment key={staticHost.url}>
{index > 0 && `, `}
<ItemDescriptionLink to={staticHost.url}>
Expand Down
10 changes: 5 additions & 5 deletions www/src/components/features/evaluation-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class EvaluationTable extends Component {
[].concat([
<SectionHeaderBottom
options={options}
display={row.node.Subcategory}
category={row.node.Subcategory}
display={row.Subcategory}
category={row.Subcategory}
key={`section-header-${s}-bottom-${i}`}
/>,
// table row with the name of the feature and corresponding scores
Expand All @@ -81,7 +81,7 @@ class EvaluationTable extends Component {
}}
id={
j === 0
? row.node.Feature.toLowerCase()
? row.Feature.toLowerCase()
.split(` `)
.join(`-`)
: undefined
Expand All @@ -92,7 +92,7 @@ class EvaluationTable extends Component {
})
}}
>
{renderCell(row.node[nodeProperty], j)}
{renderCell(row[nodeProperty], j)}
</td>
))}
</tr>,
Expand All @@ -117,7 +117,7 @@ class EvaluationTable extends Component {
{
<span
dangerouslySetInnerHTML={{
__html: row.node.Description,
__html: row.Description,
}}
/>
}
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/features/simple-evaluation-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SimpleEvaluationTable = ({ title, headers, data }) => (
<table>
<tbody>
<SectionHeaderTop columnHeaders={headers.map(h => h.display)} />
{data.map(({ node }, idx) => (
{data.map((node, idx) => (
<tr key={`feature-row-${idx}`}>
{headers.map((header, i) => (
<td
Expand Down
14 changes: 6 additions & 8 deletions www/src/components/homepage/homepage-logo-banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@ const HomepageLogoBanner = () => {
}
sort: { fields: publicURL }
) {
edges {
node {
base
childImageSharp {
fixed(quality: 75, height: 24) {
...GatsbyImageSharpFixed_tracedSVG
}
nodes {
base
childImageSharp {
fixed(quality: 75, height: 24) {
...GatsbyImageSharpFixed_tracedSVG
}
}
}
Expand All @@ -93,7 +91,7 @@ const HomepageLogoBanner = () => {
<Name>Trusted by</Name>
</Title>
<LogoGroup>
{data.allFile.edges.map(({ node: image }) => (
{data.allFile.nodes.map(image => (
<Img
alt={`${image.base.split(`.`)[0]}`}
fixed={image.childImageSharp.fixed}
Expand Down
6 changes: 2 additions & 4 deletions www/src/pages/creators/agencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ export default AgenciesPage
export const pageQuery = graphql`
query {
allCreatorsYaml(filter: { type: { eq: "agency" } }) {
edges {
node {
...CreatorData
}
nodes {
...CreatorData
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions www/src/pages/creators/companies.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ export default CompaniesPage
export const pageQuery = graphql`
query {
allCreatorsYaml(filter: { type: { eq: "company" } }) {
edges {
node {
...CreatorData
}
nodes {
...CreatorData
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions www/src/pages/creators/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ export default CreatorsPage
export const pageQuery = graphql`
query {
allCreatorsYaml {
edges {
node {
...CreatorData
}
nodes {
...CreatorData
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions www/src/pages/creators/people.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ export default PeoplePage
export const pageQuery = graphql`
query {
allCreatorsYaml(filter: { type: { eq: "individual" } }) {
edges {
node {
...CreatorData
}
nodes {
...CreatorData
}
}
}
Expand Down
60 changes: 27 additions & 33 deletions www/src/pages/ecosystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ class EcosystemPage extends Component {
const {
location,
data: {
allStartersYaml: { edges: startersData },
allNpmPackage: { edges: pluginsData },
allStartersYaml: { nodes: startersData },
allNpmPackage: { nodes: pluginsData },
},
} = this.props

const starters = startersData.map(item => {
const {
node: {
fields: {
starterShowcase: { slug, name, description, stars },
},
childScreenshot: {
screenshotFile: {
childImageSharp: { fixed: thumbnail },
},
fields: {
starterShowcase: { slug, name, description, stars },
},
childScreenshot: {
screenshotFile: {
childImageSharp: { fixed: thumbnail },
},
},
} = item
Expand All @@ -42,7 +40,7 @@ class EcosystemPage extends Component {
}
})

const plugins = pluginsData.map(item => item.node)
const plugins = pluginsData

const pageTitle = `Ecosystem`
const boardIcons = { plugins: PluginsIcon, starters: StartersIcon }
Expand Down Expand Up @@ -76,36 +74,32 @@ export const ecosystemQuery = graphql`
fields: { featured: { eq: true }, hasScreenshot: { eq: true } }
}
) {
edges {
node {
fields {
starterShowcase {
slug
description
stars
name
}
nodes {
fields {
starterShowcase {
slug
description
stars
name
}
childScreenshot {
screenshotFile {
childImageSharp {
fixed(width: 64, height: 64) {
...GatsbyImageSharpFixed_noBase64
}
}
childScreenshot {
screenshotFile {
childImageSharp {
fixed(width: 64, height: 64) {
...GatsbyImageSharpFixed_noBase64
}
}
}
}
}
}
allNpmPackage(filter: { fields: { featured: { eq: true } } }) {
edges {
node {
slug
name
description
humanDownloadsLast30Days
}
nodes {
slug
name
description
humanDownloadsLast30Days
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions www/src/pages/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class FeaturesPage extends Component {
},
{ display: `Traditional CMS`, nodeFieldProperty: `Cms` },
]}
data={this.props.data.allGatsbyFeaturesSpecsCsv.edges}
data={this.props.data.allGatsbyFeaturesSpecsCsv.nodes}
/>
<FeaturesFooter />
</main>
Expand All @@ -142,14 +142,12 @@ export default FeaturesPage
export const pageQuery = graphql`
query {
allGatsbyFeaturesSpecsCsv {
edges {
node {
Category
Gatsby
Jamstack
Cms
Description
}
nodes {
Category
Gatsby
Jamstack
Cms
Description
}
}
}
Expand Down
20 changes: 9 additions & 11 deletions www/src/pages/features/cms.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const CmsFeaturesPage = ({ data, location }) => {
})

const { sections, sectionHeaders } = getFeaturesData(
data.allGatsbyCmsSpecsCsv.edges
data.allGatsbyCmsSpecsCsv.nodes
)

return (
Expand Down Expand Up @@ -98,16 +98,14 @@ export default CmsFeaturesPage
export const pageQuery = graphql`
query {
allGatsbyCmsSpecsCsv {
edges {
node {
Category
Subcategory
Feature
Gatsby
WordPress
Drupal
Description
}
nodes {
Category
Subcategory
Feature
Gatsby
WordPress
Drupal
Description
}
}
}
Expand Down
24 changes: 11 additions & 13 deletions www/src/pages/features/jamstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const JamstackFeaturesPage = ({ data, location }) => {
})

const { sections, sectionHeaders } = getFeaturesData(
data.allGatsbyJamstackSpecsCsv.edges
data.allGatsbyJamstackSpecsCsv.nodes
)

return (
Expand Down Expand Up @@ -99,18 +99,16 @@ export default JamstackFeaturesPage
export const pageQuery = graphql`
query {
allGatsbyJamstackSpecsCsv {
edges {
node {
Category
Subcategory
Feature
Gatsby
Nextjs
Jekyll
Hugo
Nuxtjs
Description
}
nodes {
Category
Subcategory
Feature
Gatsby
Nextjs
Jekyll
Hugo
Nuxtjs
Description
}
}
}
Expand Down
Loading

0 comments on commit 8a90c53

Please sign in to comment.