-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v4] improve explorer styles (#3738)
* improve explorer styles * aa
- Loading branch information
1 parent
3a2580e
commit eaa415c
Showing
4 changed files
with
61 additions
and
40 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphiql/plugin-explorer': patch | ||
--- | ||
|
||
improve explorer styles |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- | ||
* Copyright (c) 2021 GraphQL Contributors | ||
* Copyright (c) 2024 GraphQL Contributors | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
|
@@ -8,29 +8,25 @@ | |
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title></title> | ||
<title>GraphiQL Plugin Explorer Demo</title> | ||
<style> | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
width: 100%; | ||
overflow: hidden; | ||
overflow: hidden; /* in Firefox */ | ||
} | ||
|
||
#graphiql { | ||
height: 100vh; | ||
height: 100dvh; | ||
} | ||
</style> | ||
|
||
<link rel="stylesheet" href="https://unpkg.com/graphiql/dist/style.css" /> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css" | ||
/> | ||
</head> | ||
|
||
<body> | ||
<div id="graphiql">Loading...</div> | ||
.loading { | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: 4rem; | ||
} | ||
</style> | ||
|
||
<script | ||
crossorigin | ||
|
@@ -42,34 +38,45 @@ | |
></script> | ||
|
||
<script | ||
src="https://unpkg.com/graphiql/dist/index.umd.js" | ||
src="https://unpkg.com/graphiql@4.0.0-alpha.5/dist/index.umd.js" | ||
crossorigin | ||
></script> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/[email protected]/dist/style.css" | ||
/> | ||
|
||
<script | ||
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js" | ||
integrity="sha512-Fjas/uSkzvsFjbv4jqU9nt4ulU7LDjiMAXW2YFTYD96NgKS1fhhAsGR4b2k2VaVLsE29aia3vyobAq9TNzusvA==" | ||
crossorigin="anonymous" | ||
src="https://unpkg.com/@graphiql/[email protected]/dist/index.umd.js" | ||
crossorigin | ||
></script> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/@graphiql/[email protected]/dist/style.css" | ||
/> | ||
</head> | ||
|
||
<body> | ||
<div id="graphiql"> | ||
<div class="loading">Loading…</div> | ||
</div> | ||
|
||
<script> | ||
var fetcher = GraphiQL.createFetcher({ | ||
const fetcher = GraphiQL.createFetcher({ | ||
url: 'https://swapi-graphql.netlify.app/.netlify/functions/index', | ||
}); | ||
var defaultQuery = | ||
'query AllFilms {\n allFilms {\n films {\n title\n }\n }\n}'; | ||
var explorerPlugin = GraphiQLPluginExplorer.explorerPlugin(); | ||
const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin(); | ||
|
||
function GraphiQLWithExplorer() { | ||
return React.createElement(GraphiQL, { | ||
const root = ReactDOM.createRoot(document.getElementById('graphiql')); | ||
root.render( | ||
React.createElement(GraphiQL, { | ||
fetcher: fetcher, | ||
defaultEditorToolsVisibility: true, | ||
plugins: [explorerPlugin], | ||
defaultQuery: defaultQuery, | ||
}); | ||
} | ||
|
||
const root = ReactDOM.createRoot(document.getElementById('graphiql')); | ||
root.render(React.createElement(GraphiQLWithExplorer)); | ||
defaultQuery: | ||
'query AllFilms {\n allFilms {\n films {\n title\n }\n }\n}', | ||
}), | ||
); | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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