Created
June 26, 2019 18:01
-
-
Save sumitkharche/6da1c6d08fb9d921f3dadf01db302ef3 to your computer and use it in GitHub Desktop.
index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import {withRouteData} from 'react-static' | |
import {Link } from '@reach/router' | |
export default withRouteData(({posts}) =>( | |
<React.Fragment> | |
<div className="container"> | |
{posts.map(post => ( | |
<Link key={post._id} to={`/post/${post._id}`} className="card"> | |
<div style={{ paddingRight: "1em" }}> | |
<img | |
alt={post.metadata.title} | |
className="card-img" | |
src={post.metadata.image.url} | |
/> | |
</div> | |
<div> | |
<h3 style={{ margin: 0 }}>{post.metadata.title}</h3> | |
</div> | |
</Link> | |
))} | |
</div> | |
</React.Fragment> | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment