Skip to content

Instantly share code, notes, and snippets.

@daydream05
Created August 24, 2018 17:03
Show Gist options
  • Save daydream05/f24232f835b3c2f6b9180e493ab2d96e to your computer and use it in GitHub Desktop.
Save daydream05/f24232f835b3c2f6b9180e493ab2d96e to your computer and use it in GitHub Desktop.
<Media query="(max-width: 550px)">
{matches =>
matches ? (
<CardCarousel>
{blogs.map((blog, index) => {
return (
<Link
key={index}
to={blog.node.fields.path}
>
<BlogCard
key={index}
imageFluid={blog.node.coverPhoto.fluid}
tags={blog.node.tags}
excerpt={blog.node.article.childMarkdownRemark.excerpt}
title={blog.node.title}
/>
</Link>
)
})}
</CardCarousel>
) : (
<Row>
{blogs.map((blog, index) => {
return (
<Col
key={index}
md={4}
>
<Link
to={blog.node.fields.path}
>
<BlogCard
key={index}
imageFluid={blog.node.coverPhoto.fluid}
tags={blog.node.tags}
excerpt={blog.node.article.childMarkdownRemark.excerpt}
title={blog.node.title}
/>
</Link>
</Col>
)
})}
</Row>
)
}
</Media>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment