Giter VIP home page Giter VIP logo

Comments (8)

Frithir avatar Frithir commented on May 30, 2024

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.

emmadigital avatar emmadigital commented on May 30, 2024

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.

Frithir avatar Frithir commented on May 30, 2024

what dose the graphql return when you drill down to:
heroslider {
slider {
image {
childImageSharp {
fluid(maxWidth: 1600, quality: 64) {
...GatsbyImageSharpFluid
}
}
}
}
}

from yellowcake.

emmadigital avatar emmadigital commented on May 30, 2024

Below is the screenshot for console.log(heroslider.slider) and console.log(intro.blurbs)

Heroslider
image

Features
image

from yellowcake.

emmadigital avatar emmadigital commented on May 30, 2024

Hi @firthir Any suggestions what I am doing wrong?

from yellowcake.

Frithir avatar Frithir commented on May 30, 2024

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.

emmadigital avatar emmadigital commented on May 30, 2024

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 
          }
        }

I tried with this technique it gives below error

image

from yellowcake.

emmadigital avatar emmadigital commented on May 30, 2024

Any suggestion @firthir why i am getting this error?

from yellowcake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.