-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add a new slide to the homepage
Arpit Sheth edited this page Jul 30, 2020
·
3 revisions
- Add a Slide component to your theme's
/src/@shetharp/gatsby-theme-polaroid/data/slides.tsx
file.- You can also split individual slides into their own file and import them here.
- Give this slide a unique
id
prop. Edit any other props as needed. - Add a new background image inside
/content/images
- If you have lots of images in your site, you could consider creating a directory specifically for slide images such as
/content/images/slides
- If you have lots of images in your site, you could consider creating a directory specifically for slide images such as
- Query for the image using the
slideImageFragment
by specifying the path from inside/content/images
- Pass the responsive image data using the
fluid
prop
const Slides: React.FC<SlidesProps> = (props) => {
const slideImages = useStaticQuery(graphql`
query {
imgIntro: file(relativePath: { eq: "polaroid-bg-textured.jpg" }) {
...slideImageFragment
}
}
`);
return (
<Slide
id="intro"
title="Smile for the camera! And say hello to Polaroid."
description={
<React.Fragment>
Polaroid is a <em>photography-focused</em> Gatsby theme.
</React.Fragment>
}
fluid={slideImages.imgIntro.childImageSharp.fluid}
/>
);
};
export default Slides;