Hi I'm using Prismic as a Headless CMS and want to Query out images within the gatsby-plugin-images plugin. Unfotunatly I got no error message or anything else, its just not working.
class Index extends Component {
render() {
const {
data: { homepage },
} = this.props
const image = getImage(homepage.data.gesichter.localFile)
return (
<Layout>
<IndexWrapper id={website.skipNavId} style={{ paddingTop: '2rem', paddingBottom: '2rem' }}>
<Hero>
<HeroInner>
<H1>{homepage.data.title.text}</H1>
<GatsbyImage image={image} alt={homepage.data.gesichter.alt} />
</HeroInner>
</Hero>
</IndexWrapper>
</Layout>
)
}
}
export default Index
Index.propTypes = {
data: PropTypes.shape({
homepage: PropTypes.shape({
data: PropTypes.shape({
title: PropTypes.shape({
text: PropTypes.string.isRequired,
}),
content: PropTypes.shape({
html: PropTypes.string.isRequired,
}),
gesichter: PropTypes.shape({
alt: PropTypes.string.isRequired,
localFile: PropTypes.shape({
childImageSharp: PropTypes.shape({
gatsbyImageData: PropTypes.element.isRequired,
}),
}),
}),
}),
}),
}).isRequired,
}
export const pageQuery = graphql`
query IndexQuery {
homepage: prismicHomepage {
data {
title {
text
}
content {
html
}
gesichter {
alt
localFile {
childImageSharp {
gatsbyImageData(
width: 200
placeholder: BLURRED
layout: FULL_WIDTH
)
}
}
}
}
}
}
`
I think there is something wrong with the prop types gatsbyImageData: PropTypes.element.isRequired,
but I didn't got further.
Does anyone has an idea what to do?