Last active
May 29, 2020 18:25
-
-
Save jamiejohnsonkc/a9d081e916dec3888d51b0c9dbe40811 to your computer and use it in GitHub Desktop.
query and inject single fixed gatsby image into a page
This file contains hidden or 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
| /** @jsx jsx */ | |
| import React from "react" | |
| import { Styled, jsx } from "theme-ui" | |
| import { Link, graphql } from "gatsby" | |
| import Layout from "../components/Organisms/Layout" | |
| import SEO from "./seo" | |
| import Img from "gatsby-image" | |
| export const query = graphql` | |
| query { | |
| file(relativePath: { eq: "workshop.jpg" }) { | |
| childImageSharp { | |
| fixed(width: 125, height: 125) { | |
| ...GatsbyImageSharpFixed | |
| } | |
| } | |
| } | |
| } | |
| ` | |
| const TestingPage = ({ data }) => { | |
| return ( | |
| <Layout> | |
| <SEO title="TestingPage" /> | |
| <Styled.h4>Testing Page</Styled.h4> | |
| <Styled.h6>Image should appear below</Styled.h6> | |
| <Img | |
| className="workshop" | |
| fixed={data.file.childImageSharp.fixed} | |
| alt="headshot" | |
| /> | |
| <Styled.p> | |
| <Link to="/page-2/">Go to page 2</Link> | |
| </Styled.p> | |
| </Layout> | |
| ) | |
| } | |
| export default TestingPage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment