Last active
March 27, 2018 17:40
-
-
Save gc-codesnippets/93e8d1739eb01306f5a1e6908abd53cc 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
<Query query={DRAFTS_QUERY}> | |
{({ data, loading, error }) => { | |
if (loading) { | |
return ( | |
<div className="flex w-100 h-100 items-center justify-center pt7"> | |
<div>Loading ...</div> | |
</div> | |
) | |
} | |
if (error) { | |
return ( | |
<div className="flex w-100 h-100 items-center justify-center pt7"> | |
<div>An unexpected error occured.</div> | |
</div> | |
) | |
} | |
return ( | |
<Fragment> | |
<div className="flex justify-between items-center"> | |
<h1>Drafts</h1> | |
</div> | |
{data.drafts && | |
data.drafts.map(draft => ( | |
<Post | |
key={draft.id} | |
post={draft} | |
isDraft={!draft.isPublished} | |
/> | |
))} | |
{this.props.children} | |
</Fragment> | |
) | |
}} | |
</Query> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment