gatsby-image


PHOTO EMBED

Thu Dec 10 2020 12:56:53 GMT+0000 (UTC)

Saved by @goranbloncar

import {graphql, useStaticQuery} from 'gatsby';
import Img from 'gatsby-image'

const data = useStaticQuery(graphql`
    query Images {
      images: allFile(filter: {relativeDirectory: {eq: "Medicare"}}) {
        nodes {
          id
          childImageSharp {
            fixed (
              width: 200,
              height: 200
            ){
              ...GatsbyImageSharpFixed
            }
          }
        }
      }
      image: file(relativePath: {eq: "logo.png"}) {
        id
        childImageSharp {
          fixed (
            width: 400
          ){
            ...GatsbyImageSharpFixed
          }
          fluid {
            ...GatsbyImageSharpFluid
          }
        }
      }
    }
  `)
<Img
  fixed={data.image.childImageSharp.fixed}
  alt="logo"
/>
<Img
	fluid={data.image.childImageSharp.fluid}
	alt="logo"
/>
<div className="gallery">
  {
    data.images.nodes.map((image)=>  <Img key={image.id} fixed={image.childImageSharp.fixed} />)
  }
</div>
content_copyCOPY

https://www.gatsbyjs.com/plugins/gatsby-image/