Created
June 2, 2018 06:18
-
-
Save nickpunt/013396734240d4467ae9cf440a8414a8 to your computer and use it in GitHub Desktop.
fix for gatsbyjs airtable blog
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
<Box> | |
{posts | |
.filter(post => post.node.title.length > 0) | |
.map(({ node: post }, index) => { | |
return ( | |
<Box key={post.id}> | |
<Link to={post.slug} className={linkStyles}> | |
<Timestamp>{post.date}</Timestamp> | |
<h3>{post.title}</h3> | |
<div | |
style={{ | |
backgroundImage: 'url(' + post.image[0].url + ')', | |
backgroundSize: '100%', | |
backgroundPosition: 'center', | |
width:'100%', | |
height:'15rem' | |
}}> | |
</div> | |
<p | |
style={{ | |
marginTop: '1rem', | |
marginBottom: '2rem', | |
}}> | |
<div | |
dangerouslySetInnerHTML={{ | |
__html: String(unified() | |
.use(markdown) | |
.use(html) | |
.processSync(post.PostMarkdown.split(/\s+/).slice(0,35).join(" "))) | |
}} /> | |
</p> | |
</Link> | |
</Box> | |
); | |
})} | |
</Box> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment