Skip to content

Commit 813192e

Browse files
author
Robert Zhu
committed
Merge branch 'new-source' of https://github.com/graphql/graphql.github.io into new-source
2 parents 1ab30a7 + 748b6bc commit 813192e

File tree

3 files changed

+132
-1
lines changed

3 files changed

+132
-1
lines changed

site/_css/graphql.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ nav {
133133
}
134134

135135
section {
136-
max-width: 1020px;
136+
max-width: 1080px;
137137
margin: 0 auto;
138138
padding: 0 20px;
139139
}

site/_css/index.less

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,63 @@ body.index {
678678
.prose {
679679
max-width: 415px;
680680
}
681+
682+
.leverage-code {
683+
@pane-width: 520px;
684+
width: @pane-width;
685+
overflow-y: hidden;
686+
687+
#leverageCodeView {
688+
display: flex;
689+
flex-direction: row;
690+
left: 0;
691+
position: relative;
692+
transition: left 0.5s ease-in-out;
693+
width: @pane-width * 4;
694+
695+
& > pre {
696+
width: @pane-width;
697+
position: relative;
698+
top: 0;
699+
}
700+
701+
&.step0 {
702+
transition: none;
703+
}
704+
705+
&.step1, &.step2 {
706+
& > pre:first-child {
707+
line-height: 4 * 17px;
708+
transition:
709+
top 0.5s ease-in-out,
710+
line-height 0.5s ease-in-out;
711+
712+
&:first-line {
713+
line-height: 17px;
714+
}
715+
}
716+
}
717+
718+
&.step2 {
719+
left: -1 * @pane-width;
720+
}
721+
722+
&.step3 {
723+
left: -2 * @pane-width;
724+
}
725+
726+
&.step4 {
727+
left: -3 * @pane-width;
728+
}
729+
730+
&.step5 {
731+
left: -4 * @pane-width;
732+
& > pre:first-child {
733+
left: 4 * @pane-width;
734+
}
735+
}
736+
}
737+
}
681738
}
682739

683740
section.powered-by {

site/index.html.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,80 @@ type Person {
449449
each field in the type system, and GraphQL calls them with
450450
optimal&nbsp;concurrency.</p>
451451
</div>
452+
<div className="window leverage-code" aria-hidden>
453+
<div id="leverageCodeView">
454+
<Prism language="graphql">
455+
{`type Character {
456+
name: String
457+
homeWorld: Planet
458+
friends: [Character]
459+
}`}
460+
</Prism>
461+
<Prism>
462+
{`// type Character {
463+
class Character {
464+
// name: String
465+
getName() {
466+
return this._name
467+
}
468+
469+
// homeWorld: Planet
470+
getHomeWorld() {
471+
return fetchHomeworld(this._homeworldID)
472+
}
473+
474+
// friends: [Character]
475+
getFriends() {
476+
return this._friendIDs.map(fetchCharacter)
477+
}
478+
}`}
479+
</Prism>
480+
<Prism language="python">
481+
{`# type Character {
482+
class Character:
483+
# name: String
484+
def name(self):
485+
return self._name
486+
487+
# homeWorld: Planet
488+
def homeWorld(self):
489+
return fetchHomeworld(self._homeworldID)
490+
491+
# friends: [Character]
492+
def friends(self):
493+
return map(fetchCharacter, self._friendIDs)
494+
`}
495+
</Prism>
496+
<Prism>
497+
{`// type Character {
498+
public class Character {
499+
// name: String
500+
public String Name { get; }
501+
502+
// homeWorld: Planet
503+
public async Task<Planet> GetHomeWorldAsync() {
504+
return await FetchHomeworldAsync(_HomeworldID);
505+
}
506+
507+
// friends: [Character]
508+
public async IEnumerable<Task<Character>> GetFriendsAsync() {
509+
return _FriendIDs.Select(FetchCharacterAsync);
510+
}
511+
}`}
512+
</Prism>
513+
</div>
514+
<script dangerouslySetInnerHTML={{__html: `(function(){
515+
var i = 0;
516+
var inView = document.getElementById('leverageCodeView');
517+
var delayBefore = [ 800, 1800, 1200, 3000, 3000, 3000 ];
518+
function step() {
519+
inView.className = 'step' + i;
520+
i = (i + 1) % 6;
521+
setTimeout(step, delayBefore[i]);
522+
}
523+
step();
524+
})()`}} />
525+
</div>
452526
</section>
453527

454528
<section className="powered-by">

0 commit comments

Comments
 (0)