Hey guys, Really new at Gatsby.
I can’t figure out why image is not being displayed although it should be there.
I did correctly query for this image but it’s 0 x 0 pixels.
Here is live demo. https://bts-quotes.netlify.com/
source code. https://github.com/shimphillip/bts-quotes/blob/master/src/components/Picture/Picture.js
import React from "react"
import styled from "styled-components"
import { StaticQuery, graphql } from "gatsby"
import Img from "gatsby-image"
const Picture = () => (
<StaticQuery
query={graphql`
query {
fileName: file(relativePath: { eq: "jhope1.jpg" }) {
childImageSharp {
fluid(maxWidth: 1000) {
...GatsbyImageSharpFluid
}
}
}
}
`}
render={data => {
console.log(data.fileName.childImageSharp.fluid)
return (
<PictureWrapper>
<Img fluid={data.fileName.childImageSharp.fluid} />
</PictureWrapper>
)
}}
/>
)
export default Picture
const PictureWrapper = styled.div`
flex: 1;
display: flex;
justify-content: center;
align-items: center;
`