Skip to content

Commit a6c59c1

Browse files
authored
Merge pull request #189 from commerce-docs/ds_spectaql
Add 'back to top' to GraphQL API docs
2 parents 7d15e90 + e47d131 commit a6c59c1

File tree

6 files changed

+2572
-555
lines changed

6 files changed

+2572
-555
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<section id="{{./htmlId}}"
2+
class="operation operation-{{#if isQuery}}query{{else if isMutation}}mutation{{else if isSubscription}}subscription{{else}}unknown{{/if}}"
3+
data-traverse-target="{{./htmlId}}">
4+
{{# unless @first }}
5+
{{#if parentHtmlId }}
6+
<div class="operation-group-name">
7+
<a href="#group-{{./parentHtmlId}}">{{./parentName}}</a>
8+
</div>
9+
{{/if}}
10+
{{/unless}}
11+
12+
<h2 class="operation-heading {{#if (and isDeprecated (not @root.info.x-hideIsDeprecated)) }}operation-deprecated{{/if}}">
13+
{{md (codify name) stripParagraph="true"}}
14+
</h2>
15+
16+
{{#if (and deprecationReason (not @root.info.x-hideDeprecationReason))}}
17+
<div class="doc-row">
18+
<div class="doc-copy">
19+
<div class="doc-copy-section">
20+
<div class="deprecation-reason">
21+
{{ md deprecationReason stripParagraph=true }}
22+
</div>
23+
</div>
24+
</div>
25+
</div>
26+
{{/if}}
27+
28+
{{#if description}}
29+
<div class="doc-row">
30+
<div class="doc-copy">
31+
<div class="operation-description doc-copy-section">
32+
<h5>Description</h5>
33+
{{ md (interpolateReferences description) }}
34+
</div>
35+
</div>
36+
</div>
37+
{{/if}}
38+
39+
<div class="doc-row">
40+
<div class="doc-copy">
41+
{{#if response}}
42+
<div class="operation-response doc-copy-section">
43+
<h5>Response</h5>
44+
<p>
45+
Returns
46+
{{! If it's got items, then it's an array, and we don't care about the indefiniteArticle }}
47+
{{#unless response.isArray }}
48+
{{ indefiniteArticle response.underlyingType.name }}
49+
{{/unless}}
50+
{{~ md (mdTypeLink . codify=true) stripParagraph=true }}
51+
</p>
52+
</div>
53+
{{/if}}
54+
{{>graphql/_query-or-mutation-arguments}}
55+
</div>
56+
57+
<div class="doc-examples">
58+
{{#if (firstTruthy query mutation subscription)}}
59+
<h4 class="example-heading">Example</h4>
60+
61+
<div class="example-section example-section-is-code operation-query-example">
62+
<h5>Query</h5>
63+
{{printGraphQL (firstTruthy query mutation subscription)}}
64+
</div>
65+
66+
{{#if variables}}
67+
<div class="example-section example-section-is-code operation-variables-example">
68+
<h5>Variables</h5>
69+
{{printJSON variables}}
70+
</div>
71+
{{/if}}
72+
{{#if response.data}}
73+
<div class="example-section example-section-is-code operation-response-example">
74+
<h5>Response</h5>
75+
{{printJSON response.data}}
76+
</div>
77+
{{/if}}
78+
{{/if}}
79+
</div>
80+
<a href="#top">back to top</a>
81+
</div>
82+
</section>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<section id="{{./htmlId}}"
2+
class="definition definition-{{ kebabCase ./kind defaultValue='unknown' }}"
3+
data-traverse-target="{{./htmlId}}">
4+
{{#unless @first }}
5+
{{#if parentHtmlId }}
6+
<div class="definition-group-name">
7+
<a href="#group-{{parentHtmlId}}">{{./parentName}}</a>
8+
</div>
9+
{{/if}}
10+
{{/unless}}
11+
{{#if name}}
12+
<h2 class="definition-heading">{{name}}{{!-- - {{kind}} --}}</h2>
13+
{{/if}}
14+
15+
<div class="doc-row">
16+
{{#if (equal ./kind "SCALAR")}}
17+
{{>graphql/kinds/scalar .}}
18+
{{else if (equal ./kind "OBJECT")}}
19+
{{>graphql/kinds/object .}}
20+
{{else if (equal ./kind "ENUM")}}
21+
{{>graphql/kinds/enum .}}
22+
{{else if (equal ./kind "INPUT_OBJECT")}}
23+
{{>graphql/kinds/input-object .}}
24+
{{else if (equal ./kind "UNION")}}
25+
{{>graphql/kinds/union .}}
26+
{{else if (equal ./kind "INTERFACE")}}
27+
{{>graphql/kinds/interface .}}
28+
{{else}}
29+
{{ log "unknown type.hbs" . }}
30+
{{/if}}
31+
<a href="#top">back to top</a>
32+
</div>
33+
</section>

spectaql/config-admin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spectaql:
6464
# "spectaql": Outputs the same HTML structure as the "default" theme, but with some CSS enhancements
6565
#
6666
# Default: "default"
67-
# themeDir: ./spectaql/adobe-theme
67+
themeDir: spectaql/comdox-theme
6868
theme: spectaql
6969

7070
# If you're embedding SpectaQL's output, and you've got something like a Nav Bar that

spectaql/config-storefront.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spectaql:
6464
# "spectaql": Outputs the same HTML structure as the "default" theme, but with some CSS enhancements
6565
#
6666
# Default: "default"
67-
# themeDir: ./spectaql/adobe-theme
67+
themeDir: spectaql/comdox-theme
6868
theme: spectaql
6969

7070
# If you're embedding SpectaQL's output, and you've got something like a Nav Bar that

0 commit comments

Comments
 (0)