diff --git a/panel.html b/panel.html index d51a2e6..1d431f9 100644 --- a/panel.html +++ b/panel.html @@ -46,6 +46,10 @@ .shortEntryWrapper .header { width: 50%; } + .entryInner a { + color: rgba(111, 194, 139, 1); + text-decoration: none; + } .entryInner:nth-child(2n) { background: rgba(245, 245, 245, 1); } diff --git a/src/components/Request.js b/src/components/Definition.js similarity index 89% rename from src/components/Request.js rename to src/components/Definition.js index a47490a..4dc40fe 100644 --- a/src/components/Request.js +++ b/src/components/Definition.js @@ -29,8 +29,7 @@ Operation.propTypes = { }; -// TODO: Change this and filename to "Definition" -export default function Request({ +export default function Definition({ request, }) { const { name, operations } = request; @@ -44,6 +43,6 @@ export default function Request({ ); } -Request.propTypes = { +Definition.propTypes = { request: React.PropTypes.object.isRequired, }; diff --git a/src/components/Entry.js b/src/components/Entry.js index 5b1f078..41160d7 100644 --- a/src/components/Entry.js +++ b/src/components/Entry.js @@ -1,5 +1,12 @@ import React from 'react'; -import Request from './Request'; +import Definition from './Definition'; + +const makeGraphiQlUrl = (entry) => { + const base = entry.url; + const query = encodeURIComponent(entry.bareQuery); + const variables = encodeURIComponent(JSON.stringify(entry.queryVariables)); + return `${base}/graphiql?query=${query}&variables=${variables}`; +}; export default function Entry({ entry, @@ -13,12 +20,15 @@ export default function Entry({ {entry.data && entry.data.map((request, i) => { if (request.kind !== 'FragmentDefinition') { - return ; + return ; } })} {!entry.data && (

{entry}

)} +
+ Run in GraphiQL +
); }