Skip to content

Commit 8a77f77

Browse files
committed
feat: Improvements for API docs
- Add make preview-api-docs helper - Improve readability for URL on endpoint details
1 parent 1cbef32 commit 8a77f77

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ endif
1010

1111
test:
1212
yarn test
13+
14+
preview-api-docs:
15+
bin/preview-api-docs

src/css/_includes/development-api.scss

+10-7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
.api-block {
1010
border-radius: 3px;
1111
box-shadow: rgba(0, 0, 0, 0.07) 0px 0px 0px 1px;
12+
margin-bottom: $paragraph-margin-bottom;
1213
}
1314

1415
.api-block-header {
@@ -19,12 +20,19 @@
1920
}
2021

2122
.api-block-header.request {
22-
background-color: var(--gray-dark);
23-
color: var(--light);
23+
font-family: 'Roboto Mono';
24+
font-weight: bold;
25+
color: var(--gray-dark);
2426
display: flex;
2527
overflow-x: auto;
2628
white-space: nowrap;
2729

30+
.api-request-block-verb {
31+
color: var(--gray-dark);
32+
padding-right: 0.5rem;
33+
}
34+
35+
2836
:last-child {
2937
padding-right: 10px;
3038
}
@@ -108,11 +116,6 @@
108116
color: var(--white);
109117
}
110118

111-
.api-request-block-verb {
112-
color: var(--white);
113-
padding-right: 0.5rem;
114-
}
115-
116119
.api-params dd {
117120
margin-top: 0rem !important;
118121
}

src/templates/apiPage.tsx

+19-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ const Params = ({ params }) => (
2121
<dt>
2222
<div>
2323
<code data-index>{param.name}</code>
24-
{!!param.schema?.type && <em> ({param.schema.type}{param.schema.items && `(${param.schema.items.type})`})</em>}
24+
{!!param.schema?.type && (
25+
<em>
26+
{" "}
27+
({param.schema.type}
28+
{param.schema.items && `(${param.schema.items.type})`})
29+
</em>
30+
)}
2531
</div>
2632
{!!param.required && <div className="required">REQUIRED</div>}
2733
</dt>
@@ -174,6 +180,18 @@ export default props => {
174180
}, []);
175181
return (
176182
<BasePage sidebar={<ApiSidebar />} {...props}>
183+
<div className="row">
184+
<div className="col-12">
185+
<div className="api-block">
186+
<div className="api-block-header request">
187+
<span className="api-request-block-verb">
188+
{data.method.toUpperCase()}
189+
</span>{" "}
190+
<span>{data.apiPath}</span>
191+
</div>
192+
</div>
193+
</div>
194+
</div>
177195
<div className="row">
178196
<div className="col-6">
179197
{data.summary && <p>{data.summary}</p>}
@@ -232,12 +250,6 @@ export default props => {
232250
</div>
233251
<div className="col-6">
234252
<div className="api-block">
235-
<div className="api-block-header request">
236-
<span className="api-request-block-verb">
237-
{data.method.toUpperCase()}
238-
</span>{" "}
239-
<span>{data.apiPath}</span>
240-
</div>
241253
<pre className="api-block-example request">
242254
{apiExample.join(" \\\n")}
243255
</pre>

0 commit comments

Comments
 (0)