'How to set a value on a specific page template in Gatsby

New to Gatsby and can't get past this issue. I created a new page and on that page I want to change a value that is used in template file for the logo. On page 'my-mobile-app.js' I need to use the 'pulse' logo. Ive added it to the export default below but how do I call it from the specific page? Adding dark={true} to the <Img> changes it globally as expected. Let me know if this isn't clear.

This is the page structure:

  • my-mobiel-app.js (new page that needs to have a different logo than all others)

    • import Layout from '../../components/layout'
  • src/components/layout.js

    • import Header from "./Header"
  • src/components/Header/Header.js

    • import Logo from '../Logo'
  • And finally src/components/Logo.js has this code:

      export default ({ white, dark, pulse, ...props }) => {
          const logo = useStaticQuery(graphql`
              query {
                  white: file(relativePath: { eq: "logo/Logo-whitebg.png" }) {
                      childImageSharp {
                          fluid {
                              ...GatsbyImageSharpFluid_noBase64
                          }
                      }
                  }
                  dark: file(relativePath: { eq: "logo/Logo-darkbg.png" }) {
                      childImageSharp {
                          fluid {
                              ...GatsbyImageSharpFluid_noBase64
                          }
                      }
                  }
                  pulse: file(relativePath: { eq: "logo/Logo-pulse.svg" }) {
                      childImageSharp {
                          fluid {
                              ...GatsbyImageSharpFluid_noBase64
                          }
                      }
                  }
              }
          `)
      }
      const typeLogo = (white && 'white') || (dark && 'dark') || (pulse && 'pulse') || "white"
      return <Link to="/">
          <Img
              fluid={logo[typeLogo].childImageSharp.fluid}
              alt="Tradovate Logo"
              {...props}
              loading="eager"
              fadeIn={false}
          />
      </Link>
    


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source