Created
May 12, 2020 13:32
-
-
Save aleccool213/7d71cd899d28f179db58e3686910dfd4 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
const GITHUB_ISSUES_LIST_QUERY = gql` | |
${GITHUB_ISSUE_INFO_CARD_FRAGMENT} | |
query GithubIssuesListContainerQuery { | |
organization { | |
id | |
name | |
} | |
issues { | |
totalCount | |
pageInfo { | |
endCursor | |
hasNextPage | |
} | |
edges { | |
node { | |
...GithubIssueInfoCardFragment | |
} | |
} | |
} | |
} | |
`; | |
const GithubIssueListContainer = () => { | |
const { data } = useQuery(GITHUB_ISSUES_LIST_QUERY); | |
return ( | |
{data.issues.edges.map( | |
edge => | |
( | |
<span key={edge.node.id}> | |
<GithubIssueInfoCard issueDetails={edge.node} /> | |
</span> | |
), | |
)} | |
); | |
} | |
export const GITHUB_ISSUE_INFO_CARD_FRAGMENT = gql` | |
fragment GithubIssueInfoCardFragment on Issue { | |
id | |
title | |
description | |
} | |
`; | |
interface GithubIssueInfoCardProps { | |
issueDetails: { | |
id: string; | |
title: string; | |
description: string; | |
} | |
} | |
const GithubIssueInfoCard = ({ issueDetails }) => { | |
return ( | |
<> | |
{issueDetails.id} {issueDetails.title} {issueDetails.description} | |
</> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment