Skip to content

Commit f9a0a19

Browse files
committed
revert back demo changes
1 parent d76a379 commit f9a0a19

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

demo/index.html

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,26 @@
114114
<script type="module">
115115
// FIXME: switch to import
116116
const { renderVoyager, voyagerIntrospectionQuery } = GraphQLVoyager;
117+
const PRESETS = {
118+
'Star Wars': await fetchPreset('swapi'),
119+
Yelp: await fetchPreset('yelp'),
120+
'Shopify Storefront': await fetchPreset('shopify'),
121+
GitHub: await fetchPreset('github'),
122+
};
123+
124+
const defaultPreset = PRESETS['Star Wars'];
125+
126+
const searchParams = new URLSearchParams(window.location.search);
127+
const url = searchParams.get('url');
128+
const withCredentials = searchParams.get('withCredentials');
129+
130+
const introspection =
131+
url != null ? fetchIntrospection(url, withCredentials) : defaultPreset;
117132

118133
renderVoyager(document.getElementById('root'), {
119-
introspection: await fetchPreset('github'),
120-
allowToChangeSchema: false,
134+
introspection,
135+
introspectionPresets: PRESETS,
136+
allowToChangeSchema: true,
121137
hideVoyagerLogo: false,
122138
});
123139

@@ -144,6 +160,63 @@
144160
<main id="root">
145161
<h1 style="text-align: center; color: #5d7e86">Loading...</h1>
146162
</main>
163+
<a
164+
href="https://github.com/APIs-guru/graphql-voyager"
165+
class="github-corner"
166+
aria-label="View source on Github"
167+
><svg
168+
width="80"
169+
height="80"
170+
viewBox="0 0 250 250"
171+
style="
172+
fill: #5d7e86;
173+
color: #fff;
174+
position: absolute;
175+
top: 0;
176+
border: 0;
177+
right: 0;
178+
"
179+
aria-hidden="true"
180+
>
181+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
182+
<path
183+
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
184+
fill="currentColor"
185+
style="transform-origin: 130px 106px"
186+
class="octo-arm"
187+
></path>
188+
<path
189+
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
190+
fill="currentColor"
191+
class="octo-body"
192+
></path></svg></a
193+
><style>
194+
.github-corner:hover .octo-arm {
195+
animation: octocat-wave 560ms ease-in-out;
196+
}
197+
@keyframes octocat-wave {
198+
0%,
199+
100% {
200+
transform: rotate(0);
201+
}
202+
20%,
203+
60% {
204+
transform: rotate(-25deg);
205+
}
206+
40%,
207+
80% {
208+
transform: rotate(10deg);
209+
}
210+
}
211+
@media (max-width: 500px) {
212+
.github-corner:hover .octo-arm {
213+
animation: none;
214+
}
215+
.github-corner .octo-arm {
216+
animation: octocat-wave 560ms ease-in-out;
217+
}
218+
}
219+
</style>
147220
<div id="mobile-warning">
148221
<h1>Best served on bigger screen sizes</h1>
149222
<small>

0 commit comments

Comments
 (0)