Comments (8)
Hi @emmadigital This error message is a bit limited but 'Fluid of undefined' is referencing an image.
Make sure you are adding images where ever you call them in the CMS.
from yellowcake.
Thanks @firthir for your prompt response and guidance.
Actually, I have a component called Features which I am importing inside HomePage template, inside Features component I have to display image and I have added images from the CMS but still it shows above error. When I remove feature component the error goes away.
The error is caused by below line of codes, can you please have a look to below code, and advise what I am doing wrong. How should I display images here:
{!!item.image &&
(
<Image
resolutions="small"
src={item.image.childImageSharp.fluid.src}
alt={item.blurbsheading}
/>
)}
Features.js (Features Component)
import React from 'react'
import PropTypes from 'prop-types'
import './Gallery.css'
import Flip from 'react-reveal/Flip';
import Fade from 'react-reveal/Fade';
import Image from './Image'
const ReactMarkdown = require('react-markdown/with-html')
const FeatureGrid = ({ gridItems }) => (
<div className="Gallery">
{!!gridItems &&
gridItems.map((item) => (
<div key={item.text} className="Gallery--Item">
<section>
<div>
<Fade bottom>
<h1 className="has-text-centered" style={{
fontSize: '28px',
fontWeight: '700',
textAlign: 'center',
color: '#497070',
height: '80px',
}}>{item.blurbsheading}</h1>
</Fade>
<figure>
<Flip top>
<div style={{height: '150px'}}>
{!!item.image &&
(
<Image
resolutions="small"
src={item.image.childImageSharp.fluid.src}
alt={item.blurbsheading}
/>
)}
</div>
</Flip>
</figure>
</div>
<Fade bottom>
<p className="Gallery--Item-P"><ReactMarkdown
source={item.text}
escapeHtml={false}
/></p>
</Fade>
</section>
</div>
))}
</div>
)
FeatureGrid.propTypes = {
gridItems: PropTypes.arrayOf(
PropTypes.shape({
image: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
text: PropTypes.string,
blurbsheading: PropTypes.string,
})
),
}
export default FeatureGrid
HomePage.js
import React from 'react'
import { graphql } from 'gatsby'
import Content from '../components/Content'
import Layout from '../components/Layout'
import RecentPosts from '../components/RecentPosts'
import Accordion from '../components/Accordion'
import 'react-animated-slider/build/horizontal.css';
import Features from '../components/Features'
import Flip from 'react-reveal/Flip';
import Fade from 'react-reveal/Fade';
import AliceCarousel from "react-alice-carousel";
import "react-alice-carousel/lib/alice-carousel.css";
import HeroSlider from '../components/HeroSlider'
import CoverSection from '../components/CoverSection'
import '../components/Gallery.css'
import './custom.scss';
// Export Template for use in CMS preview
export const HomePageTemplate = ({ title, subtitle, body, intro, cover, wwcheading, wwcsubheading, heroslider, accordion, ctaheading, experiencesection, experiencevideo }) => (
<main className="Home">
<Fade bottom>
<div className="ctaheading">
<h1>{ctaheading}</h1><br />
</div>
</Fade>
<section className="section">
<div className="container">
<Features gridItems={intro.blurbs} />
</div>
</section>
<HeroSlider heroItems={heroslider.slider} />
<Fade bottom cascade>
<section>
<div class="group">
<div class="left2">
<AliceCarousel autoPlay autoPlayInterval="3000">
{experiencesection.slider.map((item, index) => (
<div>
<h1>{item.sliderheading}</h1>
<p>{item.slidertext}</p>
</div>
))}
</AliceCarousel> </div>
<div class="right2">
<Content source={experiencevideo} /> </div>
</div>
</section>
</Fade>
<br />
<br />
<br />
<section className="section">
<div class="container">
<div className="taCenter">
<Flip bottom>
<h1 className="ctaheading2">{wwcheading}</h1>
<p>{wwcsubheading}</p>
</Flip>
</div>
<Fade>
<CoverSection coverItems={cover.coversection} />
</Fade>
</div>
</section>
<Fade bottom>
<section className="section">
<div className="container">
<div className="section_3">
<Content source={body} />
</div>
</div>
</section>
</Fade>
<Fade top>
<div className="ctaheading2">
<h1>Frequently Asked Questions</h1><br />
</div>
</Fade>
<section className="section">
<div className="container">
<Accordion items={accordion} />
</div>
</section>
<section className="section">
<div className="container">
<RecentPosts />
</div>
</section>
</main>
)
// Export Default HomePage for front-end
const HomePage = ({ data: { page } }) => (
<Layout meta={page.frontmatter.meta || false}>
<HomePageTemplate {...page} {...page.frontmatter} body={page.html} />
</Layout>
)
export default HomePage
export const pageQuery = graphql`
## Query for HomePage data
## Use GraphiQL interface (http://localhost:8000/___graphql)
## $id is processed via gatsby-node.js
## query name must be unique to this file
query HomePage($id: String!) {
page: markdownRemark(id: { eq: $id }) {
...Meta
html
frontmatter {
title
subtitle
ctaheading
wwcheading
wwcsubheading
accordion {
title
contentheading
content
}
experiencesection {
slider {
sliderheading
slidertext
}
}
experiencevideo
heroslider {
slider {
slidertext
sliderheading
sliderbuttontext
sliderbuttonlink
image {
childImageSharp {
fluid(maxWidth: 1600, quality: 64) {
...GatsbyImageSharpFluid
}
}
}
}
}
intro {
blurbs {
image {
childImageSharp {
fluid(maxWidth: 200, quality: 64) {
...GatsbyImageSharpFluid
}
}
}
text
blurbsheading
}
}
cover {
coversection {
sectionheading
sectionlink
sectionlinktext
sectiontext
image {
childImageSharp {
fluid(maxWidth: 450, quality: 64) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
}
`
from yellowcake.
what dose the graphql return when you drill down to:
heroslider {
slider {
image {
childImageSharp {
fluid(maxWidth: 1600, quality: 64) {
...GatsbyImageSharpFluid
}
}
}
}
}
from yellowcake.
Below is the screenshot for console.log(heroslider.slider) and console.log(intro.blurbs)
from yellowcake.
Hi @firthir Any suggestions what I am doing wrong?
from yellowcake.
You are on the right track. You'll need to try all the debug tricks you have :)
I would first review the start components.js template. https://github.com/thriveweb/yellowcake/blob/master/src/templates/ComponentsPage.js
Try just pass image like the example
Passing just featuredImage
frontmatter {
title
template
subtitle
featuredImage
Try pass just image
frontmatter {
title
subtitle
ctaheading
wwcheading
wwcsubheading
accordion {
title
contentheading
content
}
experiencesection {
slider {
sliderheading
slidertext
}
}
experiencevideo
heroslider {
slider {
slidertext
sliderheading
sliderbuttontext
sliderbuttonlink
image
}
}
from yellowcake.
You are on the right track. You'll need to try all the debug tricks you have :)
I would first review the start components.js template. https://github.com/thriveweb/yellowcake/blob/master/src/templates/ComponentsPage.jsTry just pass image like the example
Passing just
featuredImage
frontmatter { title template subtitle featuredImage
Try pass just
image
frontmatter { title subtitle ctaheading wwcheading wwcsubheading accordion { title contentheading content } experiencesection { slider { sliderheading slidertext } } experiencevideo heroslider { slider { slidertext sliderheading sliderbuttontext sliderbuttonlink image } }
I tried with this technique it gives below error
from yellowcake.
Any suggestion @firthir why i am getting this error?
from yellowcake.
Related Issues (20)
- How do you add a new widget? HOT 2
- progress further
- Emojis going onto new line in Blog Posts
- Error - Request ID: 01GEN0Y84Y4K69QS4H42X2SXYB
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module / require() of ES modules is not supported.
- warn ESLintError HOT 1
- how can i remove the github top right corner in CMS? HOT 2
- how to change the theme colour..? HOT 1
- Creating project results in errors HOT 6
- How to change slugs for posts and pages? HOT 2
- Featured Image not displaying HOT 1
- Form submission and Google map not working HOT 1
- Graphql Query Error for featuredImages HOT 2
- Google Map dynamic values HOT 1
- Re-work the click events HOT 4
- [Praise] Adding search to starter
- Why the images do not display on mobile??
- error dependencies. error in developing . HOT 2
- Netlify CMS - Uploadcare Missing External Library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yellowcake.