Last active
May 3, 2020 17:26
-
-
Save PhillJaySaw/ed8378ff0d63c9a412793343e3297814 to your computer and use it in GitHub Desktop.
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 { graphql, StaticQuery} from 'gatsby'; | |
import Layout from "../components/layout" | |
import SEO from "../components/seo" | |
import Heart from "../images/like.png" | |
const IndexPage = () => ( | |
<Layout> | |
<SEO title="Home" /> | |
<StaticQuery | |
query={graphql` | |
query TwitterPosts { | |
allTwitterStatusesUserTimelineGetPosts { | |
edges{ | |
node{ | |
full_text | |
entities{ | |
urls{ | |
url | |
} | |
} | |
created_at | |
favorite_count | |
} | |
} | |
} | |
} | |
`} | |
render={(data) => ( | |
<div> | |
{ | |
data.allTwitterStatusesUserTimelineGetPosts.edges.map((item, i) => ( | |
<div key={i} style={{ | |
border: '2px solid rebeccapurple', borderRadius: '5px', | |
marginBottom: '20px', padding: '20px' | |
}}> | |
{item.node.full_text} | |
<div style={{ | |
display: 'flex', flexDirection: 'row', | |
justifyContent: 'flex-start', alignItems: 'center' | |
}}> | |
<div> | |
{item.node.created_at} | |
</div> | |
<div style={{ | |
display: 'flex', flexDirection: 'row', justifyContent: 'center', | |
alignItems: 'center', marginLeft: '20px' | |
}}> | |
<img src={Heart} style={{width: '15px', margin: 0}}/> | |
{item.node.favorite_count} | |
</div> | |
</div> | |
</div> | |
) | |
) | |
} | |
</div> | |
)} | |
/> | |
</Layout> | |
) | |
export default IndexPage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment