diff --git a/gatsby-node.js b/gatsby-node.js new file mode 100644 index 0000000..b50cc44 --- /dev/null +++ b/gatsby-node.js @@ -0,0 +1,50 @@ +const path = require("path") + +exports.createPages = ({ graphql, actions }) => { + const { createPage } = actions + const clientPageTemplate = path.resolve(`src/templates/clientPage.js`) + // Query for markdown nodes to use in creating pages. + // You can query for whatever data you want to create pages for e.g. + // products, portfolio items, landing pages, etc. + // Variables can be added as the second function parameter + return graphql(` + query PastClients { + allPastClientsJson(filter: {live: {eq: true}}) { + edges { + node { + name + slug + heroText + logoSrc { + id + publicURL + childImageSharp { + gatsbyImageData + } + } + sections { + title + content + } + } + } + } + } + `, { limit: 1000 }).then(result => { + if (result.errors) { + throw result.errors + } + + result.data.allPastClientsJson.edges.forEach(edge => { + let client = edge.node + + return ( createPage({ + path: `clients/${client.slug}`, + component: clientPageTemplate, + context: { + client: client + }, + })) + }) + }) +} diff --git a/src/components/PastClients.js b/src/components/PastClients.js index 84ed925..fe94e29 100644 --- a/src/components/PastClients.js +++ b/src/components/PastClients.js @@ -1,7 +1,7 @@ import React from "react"; import { GatsbyImage } from "gatsby-plugin-image"; import EmblaAutoScrollCarousel from "./embla/EmblaAutoScrollCarousel"; -import { graphql, useStaticQuery } from "gatsby"; +import { graphql, useStaticQuery, Link } from "gatsby"; const OPTIONS = { slidesToScroll: "auto", loop: true }; @@ -9,7 +9,7 @@ const ClientLogo = ({alt, publicURL, childImageSharp}) => { if (childImageSharp) { return ( { ) } else { // then it's an svg, see https://github.com/gatsbyjs/gatsby/issues/10297#issuecomment-464834529 return ( -
- {alt} +
+ {alt}
) } } -const PastClient = ({ name, logoSrc }) => { +const PastClient = ({ name, logoSrc, slug, live }) => { const imgProps = { alt: `Logo of past client company, ${name}`, ...logoSrc, } return ( -
- { ClientLogo(imgProps) } +
+ {live ? ( + + { ClientLogo(imgProps) } + + ) : ( + ClientLogo(imgProps) + )} +
) } @@ -46,6 +53,8 @@ const PastClients = () => { edges { node { name + slug + live logoSrc { id publicURL @@ -59,8 +68,8 @@ const PastClients = () => { } `) - const slides = queryData.allPastClientsJson.edges.map(({ node: { name, logoSrc } }) => ( - PastClient({ name, logoSrc }) + const slides = queryData.allPastClientsJson.edges.map(({ node: { name, logoSrc, slug, live } }) => ( + PastClient({ name, logoSrc, slug, live }) )) return ( diff --git a/src/components/client-pages/Hero.jsx b/src/components/client-pages/Hero.jsx new file mode 100644 index 0000000..a5957f7 --- /dev/null +++ b/src/components/client-pages/Hero.jsx @@ -0,0 +1,48 @@ +import * as React from 'react'; +import { ParallaxLayer } from '@react-spring/parallax'; +import { GatsbyImage } from "gatsby-plugin-image"; + +const Hero = ({ client }) => { + const imgProps = { + alt: `Logo of past client company, ${client.name}`, + ...client.logoSrc, + } + + return ( +
+
+ {HeroImage(imgProps)} +
+ {client.heroText.map(paragraph => { + return ( +

+ {paragraph} +

+ ) + })} +
+
+
+ ); +}; + +const HeroImage = ({alt, publicURL, childImageSharp}) => { + if (childImageSharp) { + return ( + + ) + } else { // then it's an svg, see https://github.com/gatsbyjs/gatsby/issues/10297#issuecomment-464834529 + return ( + {alt} + ) + } +} + +export default Hero; diff --git a/src/components/layout/Layout.js b/src/components/layout/Layout.js index 18f2478..f09be43 100644 --- a/src/components/layout/Layout.js +++ b/src/components/layout/Layout.js @@ -5,13 +5,13 @@ import AccessibilityWrapper from "./AccessibilityWrapper"; const commonWidthClasses = "max-w-6xl mx-auto px-4 md:px-6 lg:px-8"; -const Layout = ({ children }) => { +const Layout = ({ children, fullWidth = false }) => { return ( <>
-
{children}
-