Skip to content

Commit 58be701

Browse files
committed
[Style guide] Added secton on graphql api explorer
1 parent 9b4c4ca commit 58be701

File tree

1 file changed

+48
-5
lines changed
  • src/content/docs/style-guide/components

1 file changed

+48
-5
lines changed

src/content/docs/style-guide/components/code.mdx

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Write-Output "This one has a title!"
1515
```js collapse={3-5}
1616
// Collapsing
1717
const foo = {
18-
1: 1,
19-
2: 2,
20-
3: 3,
18+
1: 1,
19+
2: 2,
20+
3: 3,
2121
};
2222
```
2323

@@ -80,7 +80,7 @@ index_name = "tutorial-index"
8080
```
8181
````
8282

83-
## Playground
83+
## Workers Playground
8484

8585
If you add the `playground` option to the opening code fence for a Worker example, it will
8686
add a "Run Worker in Playground" link that will take the user to the [Worker's playground](/workers/playground/)
@@ -93,7 +93,7 @@ export default {
9393
};
9494
```
9595

96-
````mdx
96+
````mdx "playground"
9797
```js playground
9898
export default {
9999
fetch() {
@@ -102,3 +102,46 @@ export default {
102102
};
103103
```
104104
````
105+
106+
## GraphQL API explorer
107+
108+
If you add the `graphql-api-explorer` option to the opening code fence for a `graphql` code block, it will
109+
add a "Run in GraphQL API Explorer" link that will take the user to the [GraphQL API explorer](https://graphql.cloudflare.com/explorer).
110+
111+
```graphql graphql-api-explorer title="A GraphQL query"
112+
query ASingleDatasetExample($zoneTag: string, $start: Time, $end: Time) {
113+
viewer {
114+
zones(filter: { zoneTag: $zoneTag }) {
115+
firewallEventsAdaptive(
116+
filter: { datetime_gt: $start, datetime_lt: $end }
117+
limit: 2
118+
orderBy: [datetime_DESC]
119+
) {
120+
action
121+
datetime
122+
host: clientRequestHTTPHost
123+
}
124+
}
125+
}
126+
}
127+
```
128+
129+
````mdx "graphql-api-explorer"
130+
```graphql graphql-api-explorer title="A GraphQL query"
131+
query ASingleDatasetExample($zoneTag: string, $start: Time, $end: Time) {
132+
viewer {
133+
zones(filter: { zoneTag: $zoneTag }) {
134+
firewallEventsAdaptive(
135+
filter: { datetime_gt: $start, datetime_lt: $end }
136+
limit: 2
137+
orderBy: [datetime_DESC]
138+
) {
139+
action
140+
datetime
141+
host: clientRequestHTTPHost
142+
}
143+
}
144+
}
145+
}
146+
```
147+
````

0 commit comments

Comments
 (0)