diff --git a/gatsby-config.js b/gatsby-config.js index f24350b..1f23fde 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -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", }, diff --git a/gatsby-node.js b/gatsby-node.js new file mode 100644 index 0000000..80437ee --- /dev/null +++ b/gatsby-node.js @@ -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, + }, + }) + }) + + + +} diff --git a/src/pages/UseCases.js b/src/pages/UseCases.js new file mode 100644 index 0000000..cd80ccc --- /dev/null +++ b/src/pages/UseCases.js @@ -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 ( +
+

{useCasesPageData.tagline_heading}

+
+ ) +} + +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 + } + } + } + } +` diff --git a/src/pages/index.js b/src/pages/index.js index f88c7ab..ca77caf 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -3,17 +3,69 @@ import { graphql } from "gatsby" import Layout from "../components/layout" export default function Home({ data }) { - return {data.prismicTestContent.data.test_title[0].text} + + const homepageData = data.prismicHomepage.data + + return {homepageData.hero_headline} } 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 } } } diff --git a/src/pages/products.js b/src/pages/products.js new file mode 100644 index 0000000..825eda0 --- /dev/null +++ b/src/pages/products.js @@ -0,0 +1,74 @@ +import React from "react" +import { graphql } from "gatsby" + +export default function ProductSection({ data }) { + const productSectionData = data.prismicProductPage.data + + return ( +
+ {/* Mapping over individual products. TODO: separate products based on category (homeowner or commerical) */} + {productSectionData.products.map(product => { + return

{product.product.document.data.product_title}

+ })} +
+ ) +} + +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 + } + } + } + } + } + } + } + } +` diff --git a/src/schemas/Homepage.json b/src/schemas/Homepage.json new file mode 100644 index 0000000..b901d4f --- /dev/null +++ b/src/schemas/Homepage.json @@ -0,0 +1,153 @@ +{ + "Main" : { }, + "Hero Section" : { + "hero_headline" : { + "type" : "Text", + "config" : { + "label" : "Hero Headline" + } + }, + "hero_subtext" : { + "type" : "Text", + "config" : { + "label" : "Hero Subtext" + } + }, + "hero_cta_text" : { + "type" : "Text", + "config" : { + "label" : "Hero Button Text" + } + }, + "hero_button_destination" : { + "type" : "Link", + "config" : { + "label" : "Hero Button Destination" + } + }, + "hero_background_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Hero Background Image" + } + } + }, + "Intro to Solar" : { + "section_title" : { + "type" : "Text", + "config" : { + "label" : "Section title" + } + }, + "section_description" : { + "type" : "Text", + "config" : { + "label" : "Section Description" + } + }, + "button_text" : { + "type" : "Text", + "config" : { + "label" : "Button Text" + } + }, + "button_destination" : { + "type" : "Link", + "config" : { + "label" : "Button Destination" + } + }, + "section_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Section Image" + } + } + }, + "Impact Section" : { + "impact_section_title" : { + "type" : "Text", + "config" : { + "label" : "Impact Section Title" + } + }, + "impact_description" : { + "type" : "Text", + "config" : { + "label" : "Impact Description" + } + }, + "impact_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Impact Image" + } + }, + "impact_example" : { + "type" : "Group", + "config" : { + "fields" : { + "impact_example_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Impact Example Image" + } + }, + "impact_big_text" : { + "type" : "Text", + "config" : { + "label" : "Impact Big Text" + } + }, + "impact_small_text" : { + "type" : "Text", + "config" : { + "label" : "Impact Small Text" + } + } + }, + "label" : "Impact Example" + } + } + }, + "Email Section" : { + "email_eyebrow_heading" : { + "type" : "Text", + "config" : { + "label" : "Email Eyebrow Heading" + } + }, + "enter_email_label" : { + "type" : "Text", + "config" : { + "label" : "Enter Email Label" + } + }, + "email_description" : { + "type" : "Text", + "config" : { + "label" : "Email Description" + } + }, + "sign_up_button_text" : { + "type" : "Text", + "config" : { + "label" : "Sign Up Button Text" + } + }, + "sign_up_button_destination" : { + "type" : "Link", + "config" : { + "label" : "Sign up Button Destination" + } + } + } + } \ No newline at end of file diff --git a/src/schemas/Process.json b/src/schemas/Process.json deleted file mode 100644 index 5ce758f..0000000 --- a/src/schemas/Process.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "Main" : { }, - "Header" : { - "process_header" : { - "type" : "Text", - "config" : { - "label" : "Process Header" - } - }, - "header_image" : { - "type" : "Image", - "config" : { - "constraint" : { }, - "thumbnails" : [ ], - "label" : "Header Image" - } - } - }, - "How It Works" : { - "how_header" : { - "type" : "Text", - "config" : { - "label" : "How Header" - } - }, - "how_description" : { - "type" : "StructuredText", - "config" : { - "multi" : "paragraph", - "label" : "How Description" - } - }, - "how_images" : { - "type" : "Group", - "config" : { - "fields" : { - "how_image" : { - "type" : "Image", - "config" : { - "constraint" : { }, - "thumbnails" : [ ], - "label" : "How Image" - } - } - }, - "label" : "How Images" - } - } - }, - "Find Solution" : { - "find_header" : { - "type" : "Text", - "config" : { - "label" : "Find Header" - } - }, - "find_description" : { - "type" : "Text", - "config" : { - "label" : "Find Description" - } - }, - "find_button_text" : { - "type" : "Text", - "config" : { - "label" : "Find Button Text" - } - }, - "find_button_destination" : { - "type" : "Text", - "config" : { - "label" : "Find Button Destination" - } - } - }, - "Steps" : { - "steps" : { - "type" : "Group", - "config" : { - "fields" : { - "step_image" : { - "type" : "Image", - "config" : { - "constraint" : { }, - "thumbnails" : [ ], - "label" : "Step Image" - } - }, - "step_title" : { - "type" : "Text", - "config" : { - "label" : "Step Title" - } - }, - "step_description" : { - "type" : "Text", - "config" : { - "label" : "Step Description" - } - } - }, - "label" : "Steps" - } - } - } - } \ No newline at end of file diff --git a/src/schemas/process.json b/src/schemas/process.json new file mode 100644 index 0000000..d067820 --- /dev/null +++ b/src/schemas/process.json @@ -0,0 +1,106 @@ +{ + "Main" : { }, + "Header" : { + "process_header" : { + "type" : "Text", + "config" : { + "label" : "Process Header" + } + }, + "header_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Header Image" + } + } + }, + "How It Works" : { + "how_header" : { + "type" : "Text", + "config" : { + "label" : "How Header" + } + }, + "how_description" : { + "type" : "StructuredText", + "config" : { + "multi" : "paragraph", + "label" : "How Description" + } + }, + "how_images" : { + "type" : "Group", + "config" : { + "fields" : { + "how_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "How Image" + } + } + }, + "label" : "How Images" + } + } + }, + "Find Solution" : { + "find_header" : { + "type" : "Text", + "config" : { + "label" : "Find Header" + } + }, + "find_description" : { + "type" : "Text", + "config" : { + "label" : "Find Description" + } + }, + "find_button_text" : { + "type" : "Text", + "config" : { + "label" : "Find Button Text" + } + }, + "find_button_destination" : { + "type" : "Text", + "config" : { + "label" : "Find Button Destination" + } + } + }, + "Steps" : { + "steps" : { + "type" : "Group", + "config" : { + "fields" : { + "step_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Step Image" + } + }, + "step_title" : { + "type" : "Text", + "config" : { + "label" : "Step Title" + } + }, + "step_description" : { + "type" : "Text", + "config" : { + "label" : "Step Description" + } + } + }, + "label" : "Steps" + } + } + } +} \ No newline at end of file diff --git a/src/schemas/product.json b/src/schemas/product.json new file mode 100644 index 0000000..460399d --- /dev/null +++ b/src/schemas/product.json @@ -0,0 +1,133 @@ +{ + "Main" : { + "uid" : { + "type" : "UID", + "config" : { + "label" : "url" + } + }, + "product_type" : { + "type" : "Select", + "config" : { + "options" : [ "Homeowner", "Commercial" ], + "label" : "Product Type" + } + }, + "product_title" : { + "type" : "Text", + "config" : { + "label" : "Product Title" + } + }, + "product_description" : { + "type" : "StructuredText", + "config" : { + "multi" : "paragraph", + "label" : "Product Description" + } + }, + "product_images" : { + "type" : "Group", + "config" : { + "fields" : { + "image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Image" + } + } + }, + "label" : "Product Images" + } + } + }, + "Icon Section" : { + "icon_section_title" : { + "type" : "Text", + "config" : { + "label" : "Icon Section Title" + } + }, + "icons" : { + "type" : "Group", + "config" : { + "fields" : { + "icon_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Icon Image" + } + }, + "icon_text" : { + "type" : "Text", + "config" : { + "label" : "Icon Text" + } + } + }, + "label" : "Icons" + } + } + }, + "Feature Section" : { + "feature_title" : { + "type" : "Text", + "config" : { + "label" : "Feature Title" + } + }, + "features" : { + "type" : "Group", + "config" : { + "fields" : { + "feature_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Feature Image" + } + }, + "feature_name" : { + "type" : "Text", + "config" : { + "label" : "Feature Name" + } + }, + "feature_description" : { + "type" : "StructuredText", + "config" : { + "multi" : "paragraph", + "label" : "feature description" + } + } + }, + "label" : "Features" + } + } + }, + "Product CTA" : { + "cta_title" : { + "type" : "Text", + "config" : { + "label" : "CTA Header" + } + }, + "button_title" : { + "type" : "Text", + "config" : { + "label" : "Button Title" + } + }, + "button_destination" : { + "type" : "Text", + "config" : { + "label" : "Button Destination" + } + } + } + } \ No newline at end of file diff --git a/src/schemas/product_page.json b/src/schemas/product_page.json new file mode 100644 index 0000000..fa68acf --- /dev/null +++ b/src/schemas/product_page.json @@ -0,0 +1,93 @@ +{ + "Main": {}, + "Featured Section": { + "product_page_main_heading": { + "type": "Text", + "config": { + "label": "Product Page Main Heading" + } + }, + "featured_product_heading": { + "type": "Text", + "config": { + "label": "Featured Product Heading" + } + }, + "featured_product_name": { + "type": "Text", + "config": { + "label": "Featured Product Name" + } + }, + "featured_product_description": { + "type": "Text", + "config": { + "label": "Featured Product Description" + } + }, + "featured_product_image": { + "type": "Image", + "config": { + "constraint": {}, + "thumbnails": [], + "label": "Featured Product Image" + } + }, + "learn_more_button_text": { + "type": "Text", + "config": { + "label": "Learn More Button Text" + } + }, + "learn_more_button_text_destination": { + "type": "Text", + "config": { + "label": "Learn More Button Text Destination" + } + } + }, + "Models Section": { + "model_scope": { + "type": "Group", + "config": { + "fields": { + "model_scope_heading": { + "type": "Text", + "config": { + "label": "Model Scope Heading" + } + } + }, + "label": "Model Scope" + } + }, + "products": { + "type": "Group", + "config": { + "fields": { + "product": { + "type": "Link", + "config": { + "select": "document", + "customtypes": [ + "product_page" + ], + "label": "product" + } + } + }, + "label": "Products" + } + }, + "test": { + "type": "Link", + "config": { + "select": "document", + "customtypes": [ + "product" + ], + "label": "test" + } + } + } +} \ No newline at end of file diff --git a/src/schemas/use_case.json b/src/schemas/use_case.json new file mode 100644 index 0000000..6f534f9 --- /dev/null +++ b/src/schemas/use_case.json @@ -0,0 +1,126 @@ +{ + "Main" : { + "uid" : { + "type" : "UID", + "config" : { + "label" : "uid" + } + }, + "preview_title" : { + "type" : "Text", + "config" : { + "label" : "Preview Title" + } + }, + "preview_description" : { + "type" : "Text", + "config" : { + "label" : "Preview Description" + } + }, + "preview_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Preview Image" + } + }, + "learn_more_button_text" : { + "type" : "Text", + "config" : { + "label" : "Learn More Button Text" + } + }, + "learn_more_button_destination" : { + "type" : "Link", + "config" : { + "label" : "Learn More Button Destination" + } + } + }, + "Overview" : { + "overview_heading" : { + "type" : "Text", + "config" : { + "label" : "Overview Heading" + } + }, + "overview_description" : { + "type" : "Text", + "config" : { + "label" : "Overview Description" + } + }, + "overview_image_one" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Overview Image One" + } + }, + "overview_image_two" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Overview Image Two" + } + } + }, + "Reasons" : { + "reasons_main_heading" : { + "type" : "Text", + "config" : { + "label" : "Reasons Main Heading" + } + }, + "specific_reason" : { + "type" : "Group", + "config" : { + "fields" : { + "specific_reason_heading" : { + "type" : "Text", + "config" : { + "label" : "Specific Reason Heading" + } + }, + "specific_reason_description" : { + "type" : "Text", + "config" : { + "label" : "Specific Reason Description" + } + } + }, + "label" : "Specific Reason" + } + }, + "cta_button_text" : { + "type" : "Text", + "config" : { + "label" : "CTA Button Text" + } + }, + "cta_button_destination" : { + "type" : "Link", + "config" : { + "label" : "CTA Button Destination" + } + } + }, + "Demo" : { + "demo_heading" : { + "type" : "Text", + "config" : { + "label" : "Demo Heading" + } + }, + "demo_video" : { + "type" : "Embed", + "config" : { + "label" : "Demo Video" + } + } + } + } \ No newline at end of file diff --git a/src/schemas/use_cases_page.json b/src/schemas/use_cases_page.json new file mode 100644 index 0000000..a6d4b67 --- /dev/null +++ b/src/schemas/use_cases_page.json @@ -0,0 +1,55 @@ +{ + "Main" : { }, + "Tagline" : { + "tagline_heading" : { + "type" : "Text", + "config" : { + "label" : "Tagline Heading" + } + }, + "tagline_description" : { + "type" : "Text", + "config" : { + "label" : "Tagline Description" + } + }, + "tagline_image" : { + "type" : "Image", + "config" : { + "constraint" : { }, + "thumbnails" : [ ], + "label" : "Tagline Image" + } + } + }, + "Use Cases" : { + "use_case" : { + "type" : "Link", + "config" : { + "select" : "document", + "customtypes" : [ "use_case" ], + "label" : "Use Case" + } + } + }, + "Call To Action" : { + "call_to_action_heading" : { + "type" : "Text", + "config" : { + "label" : "Call To Action Heading" + } + }, + "cta_button_text" : { + "type" : "Text", + "config" : { + "label" : "CTA Button Text" + } + }, + "cta_button_destination" : { + "type" : "Link", + "config" : { + "label" : "CTA Button Destination" + } + } + } + } \ No newline at end of file diff --git a/src/templates/product.js b/src/templates/product.js new file mode 100644 index 0000000..1732b29 --- /dev/null +++ b/src/templates/product.js @@ -0,0 +1,53 @@ +import React from "react" +import { graphql } from "gatsby" + +export default function Product({ data }) { + const products = data.allPrismicProduct.edges[0].node + + return

{products.data.product_title}

+} + +export const query = graphql` + query($uid: String!) { + allPrismicProduct(filter: { uid: { eq: $uid } }) { + edges { + node { + id + uid + 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 + } + } + } + } + } +` diff --git a/src/templates/use_case.js b/src/templates/use_case.js new file mode 100644 index 0000000..0d0a429 --- /dev/null +++ b/src/templates/use_case.js @@ -0,0 +1,52 @@ +import React from "react" +import { graphql } from "gatsby" + +export default function Product({ data }) { + const use_case = data.allPrismicUseCase.edges[0].node + + return

{use_case.data.preview_title}

+} + +export const query = graphql` + query($uid: String!) { + allPrismicUseCase(filter: { uid: { eq: $uid } }) { + edges { + node { + uid + data { + preview_title + preview_image { + url + } + specific_reason { + specific_reason_heading + specific_reason_description + } + reasons_main_heading + preview_description + overview_image_two { + url + } + overview_image_one { + url + } + overview_heading + overview_description + learn_more_button_text + learn_more_button_destination { + url + } + demo_video { + url + } + demo_heading + cta_button_text + cta_button_destination { + url + } + } + } + } + } + } +`