diff options
author | Quentin Gliech <quentingliech@gmail.com> | 2018-07-22 00:42:19 +0200 |
---|---|---|
committer | Quentin Gliech <quentingliech@gmail.com> | 2018-07-22 00:42:19 +0200 |
commit | 4901bdadd3918833fc2cf0ad47d73aeeb061af0d (patch) | |
tree | 2f5ae5a753286295fe07120050ef7625d194dd57 /webui/src/BugPage.js | |
parent | 62c422fa96d9751903e8eeb8ff6bccc45eb5995a (diff) | |
download | git-bug-4901bdadd3918833fc2cf0ad47d73aeeb061af0d.tar.gz |
webui: Split into multiple, smaller components
Diffstat (limited to 'webui/src/BugPage.js')
-rw-r--r-- | webui/src/BugPage.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/webui/src/BugPage.js b/webui/src/BugPage.js new file mode 100644 index 00000000..ec0872eb --- /dev/null +++ b/webui/src/BugPage.js @@ -0,0 +1,29 @@ +import React from "react"; +import { Query } from "react-apollo"; +import gql from "graphql-tag"; + +import CircularProgress from "@material-ui/core/CircularProgress"; + +import Bug from "./Bug"; + +const QUERY = gql` + query GetBug($id: BugID!) { + bug(id: $id) { + ...Bug + } + } + + ${Bug.fragment} +`; + +const BugPage = ({ match }) => ( + <Query query={QUERY} variables={{ id: match.params.id }}> + {({ loading, error, data }) => { + if (loading) return <CircularProgress />; + if (error) return <p>Error.</p>; + return <Bug bug={data.bug} />; + }} + </Query> +); + +export default BugPage; |