Skip to content

Commit 79e3bb1

Browse files
committed
Illustration for type evolution
1 parent 087ae3b commit 79e3bb1

File tree

2 files changed

+252
-10
lines changed

2 files changed

+252
-10
lines changed

site/_css/index.less

Lines changed: 157 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ body.index {
200200
box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 0 8px 32px rgba(0,0,0,0.12);
201201
margin: 0 -15px;
202202
overflow: hidden;
203-
padding-top: 25px;
203+
padding-top: 26px;
204204
position: relative;
205205

206206
&::before {
@@ -453,6 +453,162 @@ body.index {
453453
.prose {
454454
max-width: 415px;
455455
}
456+
457+
.type-evolution {
458+
@pane-width: 260px;
459+
width: 2 * @pane-width - 1;
460+
pointer-events: none;
461+
overflow-x: hidden;
462+
463+
.add {
464+
.code-font(@color: darken(#eaffea, 75%));
465+
&::before {
466+
content: '+';
467+
}
468+
background: #eaffea;
469+
border-left: solid 1px darken(#eaffea, 10%);
470+
}
471+
472+
.remove {
473+
.code-font(@color: darken(#ffecec, 75%));
474+
&::before {
475+
content: '-';
476+
}
477+
background: #ffecec;
478+
border-left: solid 1px darken(#ffecec, 10%);
479+
}
480+
481+
.add, .remove {
482+
opacity: 0;
483+
transition: opacity 0.5s ease-in-out;
484+
position: absolute;
485+
left: -1px;
486+
right: 0;
487+
height: 18px;
488+
padding-left: 2px;
489+
}
490+
491+
#typeEvolveView {
492+
display: flex;
493+
left: 0;
494+
margin-left: -1px;
495+
position: relative;
496+
width: 5 * @pane-width;
497+
498+
.v1, .v2, .v3, .v4, .v5 {
499+
border-left: solid 1px #eee;
500+
flex: 1;
501+
padding: 4px 6px 18px;
502+
position: relative;
503+
width: @pane-width;
504+
}
505+
506+
507+
&.step0 {
508+
.v2 {
509+
opacity: 0;
510+
}
511+
}
512+
513+
&.step1 {
514+
.v2 {
515+
opacity: 1;
516+
transition: opacity 0.5s ease-in-out;
517+
}
518+
519+
.v2 .add {
520+
opacity: 1;
521+
}
522+
}
523+
524+
&.step2 {
525+
left: -1 * @pane-width;
526+
transition: left 0.5s ease-in-out;
527+
528+
.v3 .add {
529+
opacity: 1;
530+
}
531+
}
532+
533+
&.step3 {
534+
left: -2 * @pane-width;
535+
transition: left 0.5s ease-in-out;
536+
537+
.v4 .add {
538+
opacity: 1;
539+
}
540+
}
541+
542+
&.step4 {
543+
left: -3 * @pane-width;
544+
transition: left 0.5s ease-in-out;
545+
546+
.v4 .remove {
547+
opacity: 1;
548+
}
549+
550+
.v5 .add {
551+
opacity: 1;
552+
}
553+
}
554+
555+
&.step5 {
556+
left: -4 * @pane-width;
557+
transition: left 0.5s ease-in-out;
558+
559+
.v4 .remove {
560+
opacity: 1;
561+
}
562+
}
563+
564+
&.step6 {
565+
.v2 {
566+
opacity: 0;
567+
}
568+
569+
.v5 {
570+
left: -4 * @pane-width;
571+
opacity: 0;
572+
transition: opacity 0.5s ease-in-out;
573+
}
574+
}
575+
}
576+
577+
.v2 .add {
578+
top: 12px + 4 * 17px;
579+
}
580+
581+
.v3 .add {
582+
top: 12px + 5 * 17px;
583+
}
584+
585+
.v4 .add:nth-child(1) {
586+
top: 12px + 6 * 17px;
587+
}
588+
.v4 .add:nth-child(2) {
589+
top: 12px + 9 * 17px;
590+
}
591+
.v4 .add:nth-child(3) {
592+
top: 12px + 10 * 17px;
593+
}
594+
.v4 .add:nth-child(4) {
595+
top: 12px + 11 * 17px;
596+
}
597+
.v4 .add:nth-child(5) {
598+
top: 12px + 12 * 17px;
599+
}
600+
.v4 .add:nth-child(6) {
601+
top: 12px + 13 * 17px;
602+
}
603+
604+
.v4 .remove {
605+
top: 12px + 5 * 17px;
606+
}
607+
608+
.v5 .add {
609+
top: 12px + 5 * 17px;
610+
}
611+
}
456612
}
457613

458614
section.point6 {

site/index.html.js

Lines changed: 95 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,20 +333,106 @@ type Species {
333333
<h2>Evolve your API<br />without versions</h2>
334334
{/*Illustration showing more legs added to a graph? Or a type evolving over time?]*/}
335335
<p>
336-
Add new fields and types to a GraphQL API without affecting
337-
queries sent from existing apps. Aging fields can be deprecated
338-
and hidden from documentation. By using a single version, GraphQL
339-
APIs give apps easier access to new features and enable cleaner,
340-
more maintainable server&nbsp;code.</p>
336+
Add new fields and types to your GraphQL API without impacting
337+
existing queries. Aging fields can be deprecated
338+
and hidden from tools. By using a single evolving version,
339+
GraphQL APIs give apps continuous access to new features and
340+
encourage cleaner, more maintainable server&nbsp;code.</p>
341341
</div>
342342
<div className="window type-evolution" aria-hidden>
343-
<Prism language="graphql">
344-
{`type Film {
343+
<div id="typeEvolveView">
344+
<div className="v1">
345+
<Prism language="graphql">
346+
{`type Film {
347+
title: String
348+
episode: Int
349+
releaseDate: String
350+
351+
352+
353+
}`}
354+
</Prism>
355+
</div>
356+
<div className="v2">
357+
<div className="add" />
358+
<Prism language="graphql">
359+
{`type Film {
360+
title: String
361+
episode: Int
362+
releaseDate: String
363+
openingCrawl: String
364+
365+
366+
}`}
367+
</Prism>
368+
</div>
369+
<div className="v3">
370+
<div className="add" />
371+
<Prism language="graphql">
372+
{`type Film {
373+
title: String
374+
episode: Int
375+
releaseDate: String
376+
openingCrawl: String
377+
director: String
378+
379+
}`}
380+
</Prism>
381+
</div>
382+
<div className="v4">
383+
<div className="add" />
384+
<div className="add" />
385+
<div className="add" />
386+
<div className="add" />
387+
<div className="add" />
388+
<div className="add" />
389+
<div className="remove" />
390+
<Prism language="graphql">
391+
{`type Film {
345392
title: String
346393
episode: Int
394+
releaseDate: String
395+
openingCrawl: String
347396
director: String
397+
directedBy: Person
398+
}
399+
400+
type Person {
401+
name: String
402+
directed: [Film]
403+
actedIn: [Film]
404+
}`}
405+
</Prism>
406+
</div>
407+
<div className="v5">
408+
<div className="add" />
409+
<Prism language="graphql">
410+
{`type Film {
411+
title: String
412+
episode: Int
413+
releaseDate: String
414+
openingCrawl: String
415+
director: String @deprecated
416+
directedBy: Person
417+
}
418+
419+
type Person {
420+
name: String
421+
directed: [Film]
422+
actedIn: [Film]
348423
}`}
349-
</Prism>
424+
</Prism>
425+
</div>
426+
</div>
427+
<script dangerouslySetInnerHTML={{__html: `(function(){
428+
var i = 0;
429+
var inView = document.getElementById('typeEvolveView');
430+
inView.className = 'step' + i;
431+
setInterval(function () {
432+
i = (i + 1) % 7;
433+
inView.className = 'step' + i;
434+
}, 2200);
435+
})()`}} />
350436
</div>
351437
</section>
352438
</div>
@@ -367,7 +453,7 @@ type Species {
367453
</section>
368454

369455
<section className="powered-by">
370-
<h2>Powered by GraphQL</h2>
456+
<h2>Who&rsquo;s using GraphQL?</h2>
371457
<div>Logo grid goes here</div>
372458
</section>
373459

0 commit comments

Comments
 (0)