Skip to content

Commit

Permalink
Merge pull request #10 from vossik/Floating-buttons-fixes
Browse files Browse the repository at this point in the history
Copy current section link
  • Loading branch information
peldax authored May 16, 2021
2 parents 7630ef4 + 72be420 commit 73db95a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 35 deletions.
51 changes: 34 additions & 17 deletions src/HtmlVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ public function visitSchema(\Graphpinator\Type\Schema $schema) : string
<section id="graphql-schema">
{$this->printDescription($schema->getDescription())}
<div class="line">
<span class="keyword">schema</span>&nbsp;
<span class="bracket-curly">{</span>
<a href="#graphql-schema" class="self-link">
<span class="keyword">schema</span>
</a>
&nbsp;<span class="bracket-curly">{</span>
</div>
<div class="offset">
<div class="line">
Expand Down Expand Up @@ -59,8 +61,10 @@ public function visitType(\Graphpinator\Type\Type $type) : string
<section id="graphql-type-{$type->getName()}">
{$this->printDescription($type->getDescription())}
<div class="line">
<span class="keyword">type</span>&nbsp;
<span class="typename">{$type->getName()}</span>
<a href="#graphql-type-{$type->getName()}" class="self-link">
<span class="keyword">type</span>&nbsp;
<span class="typename">{$type->getName()}</span>
</a>
{$this->printImplements($type->getInterfaces())}
{$this->printDirectiveUsages($type->getDirectiveUsages())}&nbsp;
<span class="bracket-curly">{</span>
Expand All @@ -81,8 +85,10 @@ public function visitInterface(\Graphpinator\Type\InterfaceType $interface) : st
<section id="graphql-type-{$interface->getName()}">
{$this->printDescription($interface->getDescription())}
<div class="line">
<span class="keyword">interface</span>&nbsp;
<span class="typename">{$interface->getName()}</span>
<a href="#graphql-type-{$interface->getName()}" class="self-link">
<span class="keyword">interface</span>&nbsp;
<span class="typename">{$interface->getName()}</span>
</a>
{$this->printImplements($interface->getInterfaces())}
{$this->printDirectiveUsages($interface->getDirectiveUsages())}&nbsp;
<span class="bracket-curly">{</span>
Expand Down Expand Up @@ -111,8 +117,11 @@ public function visitUnion(\Graphpinator\Type\UnionType $union) : string
<section id="graphql-type-{$union->getName()}">
{$this->printDescription($union->getDescription())}
<div class="line">
<span class="keyword">union</span>&nbsp;
<span class="typename">{$union->getName()}&nbsp;<span class="equals">=</span>&nbsp;{$types}</span>
<a href="#graphql-type-{$union->getName()}" class="self-link">
<span class="keyword">union</span>&nbsp;
<span class="typename">{$union->getName()}</span>
</a>
&nbsp;<span class="equals">=</span>&nbsp;{$types}
</div>
</section>
EOL;
Expand All @@ -124,8 +133,10 @@ public function visitInput(\Graphpinator\Type\InputType $input) : string
<section id="graphql-type-{$input->getName()}">
{$this->printDescription($input->getDescription())}
<div class="line">
<span class="keyword">input</span>&nbsp;
<span class="typename">{$input->getName()}</span>
<a href="#graphql-type-{$input->getName()}" class="self-link">
<span class="keyword">input</span>&nbsp;
<span class="typename">{$input->getName()}</span>
</a>
{$this->printDirectiveUsages($input->getDirectiveUsages())}&nbsp;
<span class="bracket-curly">{</span>
</div>
Expand All @@ -145,8 +156,10 @@ public function visitScalar(\Graphpinator\Type\ScalarType $scalar) : string
<section id="graphql-type-{$scalar->getName()}">
{$this->printDescription($scalar->getDescription())}
<div class="line">
<span class="keyword">scalar</span>&nbsp;
<span class="typename">{$scalar->getName()}</span>
<a href="#graphql-type-{$scalar->getName()}" class="self-link">
<span class="keyword">scalar</span>&nbsp;
<span class="typename">{$scalar->getName()}</span>
</a>
</div>
</section>
EOL;
Expand All @@ -158,9 +171,11 @@ public function visitEnum(\Graphpinator\Type\EnumType $enum) : string
<section id="graphql-type-{$enum->getName()}">
{$this->printDescription($enum->getDescription())}
<div class="line">
<span class="keyword">enum</span>&nbsp;
<span class="typename">{$enum->getName()}</span>&nbsp;
<span class="bracket-curly">{</span>
<a href="#graphql-type-{$enum->getName()}" class="self-link">
<span class="keyword">enum</span>&nbsp;
<span class="typename">{$enum->getName()}</span>
</a>
&nbsp;<span class="bracket-curly">{</span>
</div>
<div class="offset">
{$this->printItems($enum->getItems())}
Expand All @@ -186,8 +201,10 @@ public function visitDirective(\Graphpinator\Directive\Directive $directive) : s
<section id="graphql-directive-{$directive->getName()}">
{$this->printDescription($directive->getDescription())}
<div class="line">
<span class="keyword">directive</span>&nbsp;
<span class="typename">@{$directive->getName()}</span>
<a href="#graphql-directive-{$directive->getName()}" class="self-link">
<span class="keyword">directive</span>&nbsp;
<span class="typename">@{$directive->getName()}</span>
</a>
{$this->printArguments($directive)}
{$repeatable}&nbsp;<span class="keyword">on</span>&nbsp;<span class="enum-literal">{$locations}</span>
</div>
Expand Down
10 changes: 8 additions & 2 deletions src/theme/default.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.graphpinator-schema {
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
background: rgb(39, 40, 34);
padding: 10px;
padding: 10px 0 10px 10px;
counter-reset: line;
overflow-x: scroll;
}
.graphpinator-schema > .code {
position: relative;
padding-left: 65px;
padding-left: 75px;
}
.keyword, .ampersand {
color: rgb(102, 217, 239);
Expand Down Expand Up @@ -94,3 +94,9 @@ section:target {
.floating-button:not(:first-child) {
margin-left: 5px;
}
.self-link:hover:before {
content: "\01F517";
margin-left: -16px;
font-size: 14px;
padding-right: 2px;
}
Loading

0 comments on commit 73db95a

Please sign in to comment.