Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Vote UI solution #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
indent_style = space
indent_size = 4
10 changes: 6 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
}
"semi": false,
"singleQuote": true,
"tabWidth": 4,
"useTabs": false,
"trailingComma": "es5"
}
83 changes: 42 additions & 41 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
module.exports = {
siteMetadata: {
title: `Below The Line`,
description: `Vote Your Way`,
author: `Benno Rice`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
siteMetadata: {
title: `Below The Line`,
description: `Vote Your Way`,
author: `Benno Rice`,
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-typescript`,
`gatsby-transformer-yaml`,
`gatsby-transformer-remark`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/data`,
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.app/offline
// 'gatsby-plugin-offline',
],
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
`gatsby-plugin-typescript`,
`gatsby-transformer-yaml`,
`gatsby-transformer-remark`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/data`,
},
},
`gatsby-plugin-styled-components`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.app/offline
// 'gatsby-plugin-offline',
],
}
49 changes: 30 additions & 19 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,27 @@ exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions
return new Promise((resolve, reject) => {
graphql(`
{
allStatesYaml {
edges {
node {
fields {
slug
{
allStatesYaml {
edges {
node {
fields {
slug
}
}
}
}
}
}
},
allDivisionsYaml {
edges {
node {
fields {
slug
allDivisionsYaml {
edges {
node {
fields {
slug
}
}
}
}
}
}
}
}
`
).then(result => {
`).then(result => {
result.data.allStatesYaml.edges.forEach(({ node }) => {
createPage({
path: node.fields.slug,
Expand All @@ -61,6 +60,18 @@ exports.createPages = ({ graphql, actions }) => {
},
})
})

// Temporary Vote page creation before data is available
createPage({
path: 'vote',
component: path.resolve(`./src/templates/vote-page.js`),
context: {
// Data passed to context is available
// in page queries as GraphQL variables.
slug: 'vote',
},
})

resolve()
})
})
Expand Down
Loading