Skip to content

Commit

Permalink
Merge branch 'master' into #13-footer-component
Browse files Browse the repository at this point in the history
  • Loading branch information
samgildea committed Mar 25, 2021
2 parents d560a09 + c53ea83 commit 08836db
Show file tree
Hide file tree
Showing 14 changed files with 1,014 additions and 114 deletions.
9 changes: 7 additions & 2 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ module.exports = {
schemas: {
// all the schemas here
test: require("./src/schemas/test.json"),
Process: require("./src/schemas/Process.json"),
footer: require("./src/schemas/footer.json")
product_page: require("./src/schemas/product_page.json"),
product: require("./src/schemas/product.json"),
Process: require("./src/schemas/process.json"),
Homepage: require("./src/schemas/Homepage.json"),
use_cases_page: require("./src/schemas/use_cases_page.json"),
use_case: require("./src/schemas/use_case.json")

},
typePathsFilenamePrefix: "prismic-typepaths---powerhouse-site",
},
Expand Down
64 changes: 64 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const path = require("path")
const productTemplate = path.resolve(__dirname, "./src/templates/product.js")
const useCaseTemplate = path.resolve(__dirname, "./src/templates/use_case.js")

exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions

// Query all Pages with their IDs and template data.
const pages = await graphql(`
{
allPrismicProduct {
edges {
node {
id
uid
data {
product_title
}
}
}
}
}
`)

const use_cases = await graphql(`
{
allPrismicUseCase {
edges {
node {
uid
data {
preview_title
}
}
}
}
}
`)

// Create pages for each Page in Prismic using the selected template.
use_cases.data.allPrismicUseCase.edges.forEach(node => {
createPage({
path: `/${node.node.uid}`,
component: useCaseTemplate,
context: {
uid: node.node.uid,
},
})
})

// Create pages for each Page in Prismic using the selected template.
pages.data.allPrismicProduct.edges.forEach(node => {
createPage({
path: `/${node.node.uid}`,
component: productTemplate,
context: {
uid: node.node.uid,
},
})
})



}
40 changes: 40 additions & 0 deletions src/pages/UseCases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { graphql } from "gatsby"

import React from "react"
import Layout from "../components/layout"

export default function UseCasesPage({ data }) {
const useCasesPageData = data.prismicUseCasesPage.data

return (
<div>
<h1>{useCasesPageData.tagline_heading}</h1>
</div>
)
}

export const query = graphql`
query UseCasesPageQuery {
prismicUseCasesPage {
data {
call_to_action_heading
cta_button_destination {
target
}
cta_button_text
tagline_description
tagline_heading
tagline_image {
url
dimensions {
height
width
}
}
use_case {
link_type
}
}
}
}
`
64 changes: 58 additions & 6 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,69 @@ import { graphql } from "gatsby"
import Layout from "../components/layout"

export default function Home({ data }) {
return <Layout>{data.prismicTestContent.data.test_title[0].text}</Layout>

const homepageData = data.prismicHomepage.data

return <Layout>{homepageData.hero_headline}</Layout>
}

export const query = graphql`
query TestQuery {
prismicTestContent {
query HomePageQuery {
prismicHomepage {
data {
test_title {
text
type
section_title
section_description
section_image {
url
dimensions {
height
width
}
}
button_text
button_destination {
target
}
hero_button_destination {
target
}
hero_cta_text
hero_headline
hero_subtext
hero_background_image {
url
dimensions {
height
width
}
}
impact_description
impact_section_title
impact_image {
url
dimensions {
height
width
}
}
impact_example {
impact_big_text
impact_small_text
impact_example_image {
url
dimensions {
height
width
}
}
}
email_description
email_eyebrow_heading
enter_email_label
sign_up_button_destination {
target
}
sign_up_button_text
}
}
}
Expand Down
74 changes: 74 additions & 0 deletions src/pages/products.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from "react"
import { graphql } from "gatsby"

export default function ProductSection({ data }) {
const productSectionData = data.prismicProductPage.data

return (
<div>
{/* Mapping over individual products. TODO: separate products based on category (homeowner or commerical) */}
{productSectionData.products.map(product => {
return <h1>{product.product.document.data.product_title}</h1>
})}
</div>
)
}

export const query = graphql`
query ProductPageQuery {
prismicProductPage {
data {
featured_product_description
featured_product_heading
featured_product_name
learn_more_button_text
learn_more_button_text_destination
model_scope {
model_scope_heading
}
product_page_main_heading
products {
product {
document {
... on PrismicProduct {
data {
product_title
button_destination
button_title
cta_title
feature_title
features {
feature_name
feature_description {
text
}
feature_image {
url
}
}
icon_section_title
icons {
icon_text
icon_image {
url
}
}
product_description {
text
}
product_images {
image {
url
}
}
product_type
}
}
}
}
}
}
}
}
`
Loading

0 comments on commit 08836db

Please sign in to comment.