I am trying to incorporate ai2html into a Gatsby-built repo. I realized quickly that I cannot simply used gatsby-image because I am not deploying everything to one place: my code, via public/index.html, goes to one place and my images live in AWS S3. I'm looking for a way to pull images via URL into my src/index.js, ideally in a step-by-step tutorial way because I am new at Gatsby stuff.
So far, I've tried using gatsby-source-s3 (docs here) but I'm not sure I've set it up correctly in my index.js (I've already installed it and put the relevant info in gatsby-config.js:
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import "../styles/ai_styles.css"
export default () => {
const data = useStaticQuery(graphql`
query IndexQuery {
images: allS3Images {
edges {
node {
Key
Url
}
}
}
}
`)
return (
<div>
<div id="g-crime-box" className="ai2html ai2html-box-v5">
<div id="g-mobile" className="g-artboard" style={{width: '280px', height: '2328.3424680476px'}} data-aspect-ratio="0.12" data-min-width="280" data-max-width="579">
<Img fluid={data.images.node.Url} alt="alt desktop image" />
...
</div>
My main questions are, is {data.images.node.Url} the best way to call the image or am I doing that wrong? And is this the best way to do this? Has anyone seen other ways to do this?