-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into #13-footer-component
- Loading branch information
Showing
14 changed files
with
1,014 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
}) | ||
}) | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` |
Oops, something went wrong.