Skip to content

Commit f041c66

Browse files
authored
Merge pull request #176 from ember-learn/styles/cleanup-api-docs
[style] Cleans up the API docs
2 parents 9905665 + 39f4c3b commit f041c66

File tree

9 files changed

+54
-63
lines changed

9 files changed

+54
-63
lines changed

addon/components/api/x-import-path/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import layout from './template';
33

44
export default Component.extend({
55
layout,
6-
classNames: ['import-path']
6+
tagName: ''
77
});
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
.import-path {
22
font-family: Monaco, monospace;
3-
font-size: 0.85em;
4-
5-
padding: 6px 10px;
6-
border: 1px solid #E4E4E4;
7-
border-radius: 6px;
83
}
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
<span class="hljs-keyword">import</span>
1+
{{#if item.exportType}}
2+
<h4 class="mb-2 text-grey font-bold tracking-wide uppercase text-xs">
3+
Import Path
4+
</h4>
25

3-
{{#if (eq item.exportType "default")}}
4-
{{item.name}}
5-
{{else}}
6-
{ {{item.name}} }
7-
{{/if}}
6+
<div class="import-path mb-6" data-test-import-path>
7+
<span class="hljs-keyword">import</span>
8+
9+
{{#if (eq item.exportType "default")}}
10+
{{item.name}}
11+
{{else}}
12+
{ {{item.name}} }
13+
{{/if}}
814

9-
<span class="hljs-keyword">from</span>
10-
<span class="hljs-string">'{{item.file}}'</span>;
15+
<span class="hljs-keyword">from</span>
16+
<span class="hljs-string">'{{item.file}}'</span>;
17+
</div>
18+
{{/if}}

addon/components/api/x-params/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import layout from './template';
44

55
export default Component.extend({
66
layout,
7-
classNames: ['item-params'],
7+
tagName: '',
88

99
/**
1010
* Params shouldn't be displayed when there are no descriptions and no subparams,

addon/components/api/x-params/style.scss

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,13 @@
11
.item-params {
2-
h4 {
3-
margin: 1em 0;
4-
}
5-
6-
table {
7-
font-size: 0.85em;
8-
width: 100%;
9-
10-
padding: 6px 10px;
11-
border: 1px solid #E4E4E4;
12-
border-radius: 6px;
2+
width: 100%;
133

14-
th {
15-
text-align: left;
16-
color: #777;
17-
padding: 3px 10px;
18-
}
19-
20-
td {
21-
padding: 0 20px 0 10px;
22-
}
4+
td {
5+
padding-right: 1em;
6+
}
237

24-
td:last-of-type {
25-
width: 99%;
26-
padding-right: 10px;
27-
}
8+
td:last-of-type {
9+
width: 99%;
10+
padding-right: 0;
2811
}
2912
}
3013

addon/components/api/x-params/template.hbs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
{{#if shouldDisplayParams}}
2-
<h4>Params</h4>
2+
<h4 class="mb-2 text-grey font-bold tracking-wide uppercase text-xs">
3+
Params
4+
</h4>
35

4-
<table>
5-
{{!-- <thead>
6-
<tr>
7-
<th>name</th>
8-
<th>type</th>
9-
<th>description</th>
10-
</tr>
11-
</thead> --}}
6+
<table class="item-params mb-6" data-test-item-params>
127
<tbody>
138
{{#each params as |param|}}
149
<tr data-test-item-param>

addon/components/api/x-sections/style.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@
2323
}
2424

2525
.item-section__class-header {
26+
.item-section__default-label {
27+
line-height: 1.4em;
28+
vertical-align: text-top;
29+
}
30+
2631
a {
2732
color: #333;
2833
font-size: 1.4em;
2934

3035
&:visited {
3136
color: #999;
3237
}
38+
39+
&:before {
40+
content: ''
41+
}
3342
}
3443
}
3544

addon/components/api/x-sections/template.hbs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,37 @@
88
{{#each items as |item|}}
99
<div data-test-item>
1010
{{#if (or item.isClass item.isComponent)}}
11-
<h3 id={{item.name}} data-test-item-header class="item-section__class-header mb-1">
11+
<h3 id={{item.name}} data-test-item-header class="item-section__class-header">
12+
{{#if (eq item.exportType 'default')}}
13+
<span class="item-section__default-label">Default</span>
14+
{{/if}}
15+
1216
{{#link-to 'docs.api.item' (concat 'modules/' item.id)}}
13-
{{#if (eq item.exportType 'default')}}
14-
<span class="item-section__default-label">Default</span>
15-
{{/if}}
1617
{{item.name}}
1718
{{/link-to}}
1819
</h3>
1920

2021
{{{item.description}}}
2122
{{else}}
22-
<h3 id={{item.name}} data-test-item-header data-text="{{item.name}}" class="docs-h3 mb-1">
23-
<a href="#{{item.name}}" class="docs-header-link">
24-
{{#if (eq item.exportType 'default')}}
25-
<span class="item-section__default-label">Default</span>
26-
{{/if}}
23+
<h3 id={{item.name}} data-test-item-header data-text="{{item.name}}" class="docs-h3">
24+
{{#if (eq item.exportType 'default')}}
25+
<span class="item-section__default-label">Default</span>
26+
{{/if}}
2727

28+
<a href="#{{item.name}}" class="docs-header-link">
2829
{{type-signature item}}
2930
</a>
3031
</h3>
3132

32-
{{#if item.exportType}}
33-
{{api/x-import-path data-test-import-path=true item=item}}
34-
{{/if}}
35-
3633
<p data-test-item-description>
3734
{{{item.description}}}
3835
</p>
3936

40-
{{api/x-params data-test-item-params=true params=item.params}}
37+
<div class="px-6 pt-3 mt-4 border border-grey-light rounded text-sm">
38+
{{api/x-import-path item=item}}
39+
40+
{{api/x-params params=item.params}}
41+
</div>
4142
{{/if}}
4243
</div>
4344
{{/each}}

addon/tailwind/components/docs-md.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
.docs-h3,
2121
.docs-md__h3 a,
2222
.docs-h3 a {
23-
@apply pt-4 mb-2 text-grey-darkest leading-tight no-underline;
23+
@apply pt-4 mb-1 text-grey-darkest leading-tight no-underline;
2424
}
2525

2626
.docs-md p {

0 commit comments

Comments
 (0)