Skip to content

Instantly share code, notes, and snippets.

@yansusanto
Created September 17, 2019 14:40
Show Gist options
  • Save yansusanto/1703b24fa8921a0a43e3620c85fe340a to your computer and use it in GitHub Desktop.
Save yansusanto/1703b24fa8921a0a43e3620c85fe340a to your computer and use it in GitHub Desktop.
export const squareImage = graphql`
fragment squareImage on File {
childImageSharp {
fluid(maxWidth: 520, maxHeight: 400) {
...GatsbyImageSharpFluid
}
}
}
`;
export default () => {
const data = useStaticQuery(
graphql`
query {
image1: file(relativePath: { eq: "image1.png" }) {
...squareImage
}
image2: file(relativePath: { eq: "image2.png" }) {
...squareImage
}
image3: file(relativePath: { eq: "image3.png" }) {
...squareImage
}
image4: file(relativePath: { eq: "image3.png" }) {
...squareImage
}
}
`
);
return (
<>
<Section>
<Grid>
<Art>
<Img fluid={data.image1.childImageSharp.fluid} alt="" />
</Art>
</Grid>
</Section>
<Section accent="alt">
<Grid inverse>
<Art>
<Img fluid={data.image2.childImageSharp.fluid} alt="" />
</Art>
</Grid>
</Section>
<Section>
<Grid>
<Art>
<Img fluid={data.image3.childImageSharp.fluid} alt="" />
</Art>
</Grid>
</Section>
<Section accent="alt">
<Grid inverse>
<Art>
<Img fluid={data.image4.childImageSharp.fluid} alt="" />
</Art>
</Grid>
</Section>
</>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment