Skip to content

Commit 39f4c3b

Browse files
authored
Merge branch 'master' into styles/cleanup-api-docs
2 parents a60a289 + 0ef8f62 commit 39f4c3b

File tree

14 files changed

+126
-109
lines changed

14 files changed

+126
-109
lines changed

addon/components/docs-hero/template.hbs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@
33
{{if (eq style 'light') 'text-grey-darkest'}}
44
{{if (eq style 'dark') 'bg-black text-white'}}
55
">
6-
<div class='docs-container'>
7-
<h1 class='text-5xl md:text-jumbo leading-none'>
8-
{{#if logo}}
9-
<div class='md:-mb-1 -mt-4 md:-mt-8'>
10-
<span class='inline-block h-6 opacity-50'>
11-
{{docs-logo logo=logo}}
12-
</span>
13-
</div>
14-
{{/if}}
6+
<h1 class='text-5xl md:text-jumbo leading-none'>
7+
{{#if logo}}
8+
<div class='md:-mb-1 -mt-4 md:-mt-8'>
9+
<span class='inline-block h-6 opacity-50'>
10+
{{docs-logo logo=logo}}
11+
</span>
12+
</div>
13+
{{/if}}
1514

16-
<span class='font-thin'>{{slimHeading}}</span>{{strongHeading}}
17-
</h1>
15+
<span class='font-thin'>{{slimHeading}}</span>{{strongHeading}}
16+
</h1>
1817

19-
<p class='opacity-75 text-xl mt-4 w-3/4 mx-auto leading-tight'>
20-
{{byline}}
21-
</p>
18+
<p class='opacity-75 text-xl mt-4 w-3/4 mx-auto leading-tight'>
19+
{{byline}}
20+
</p>
2221

23-
{{yield}}
24-
</div>
22+
{{yield}}
2523
</div>

addon/components/docs-viewer/x-nav-item/component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { inject as service } from '@ember/service';
22
import Component from '@ember/component';
3-
import layout from './template';
43
import { next } from '@ember/runloop';
54

5+
import layout from './template';
6+
67
export default Component.extend({
78
layout,
89
tagName: '',
@@ -21,7 +22,6 @@ export default Component.extend({
2122
this.get('docsRoutes.items').addObject(this);
2223
});
2324
}
24-
2525
}).reopenClass({
2626

2727
positionalParams: ['label', 'route', 'model']
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import Component from '@ember/component';
2-
import layout from './template';
2+
import hbs from 'htmlbars-inline-precompile'
33

44
export default Component.extend({
5-
layout,
5+
tagName: 'ul',
66

7-
tagName: ''
8-
9-
// classNames: 'docs-viewer__nav-list'
7+
classNames: ['list-reset'],
108

9+
layout: hbs`
10+
{{yield (hash
11+
item=(component 'docs-viewer/x-nav-item')
12+
)}}
13+
`
1114
});

addon/components/docs-viewer/x-nav-list/template.hbs

Lines changed: 0 additions & 5 deletions
This file was deleted.

addon/components/docs-viewer/x-nav/template.hbs

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,20 @@
3131
{{yield (hash
3232
section=(component 'docs-viewer/x-section')
3333
item=(component 'docs-viewer/x-nav-item')
34-
subnav=(component 'docs-viewer/x-nav-list')
34+
subnav=(component 'docs-viewer/x-nav-list' class='ml-4')
3535
)}}
3636

3737
{{!-- Autogenerated API docs --}}
3838
{{#if (gt project.modules.length 0)}}
3939
{{docs-viewer/x-section 'API Reference' style='large'}}
4040

41-
{{#docs-viewer/x-nav-list as |subnav|}}
42-
{{#each-in project.navigationIndex as |type items|}}
43-
{{docs-viewer/x-section type}}
41+
{{#each-in project.navigationIndex as |type items|}}
42+
{{docs-viewer/x-section type}}
4443

45-
{{#docs-viewer/x-nav-list as |subnav|}}
46-
{{#if (is-array items)}}
47-
{{#each items as |item|}}
48-
{{subnav.item item.name (concat root '.api.item') item.path}}
49-
{{/each}}
50-
{{else}}
51-
{{#each-in items as |module items|}}
52-
{{subnav.item module
53-
(concat root '.api.item')
54-
(concat 'modules/' module)
55-
class="docs-viewer__module-heading"
56-
}}
57-
58-
{{#docs-viewer/x-nav-list as |subnav|}}
59-
{{#each items as |item|}}
60-
{{subnav.item item.name (concat root '.api.item') item.path}}
61-
{{/each}}
62-
{{/docs-viewer/x-nav-list}}
63-
{{/each-in}}
64-
{{/if}}
65-
{{/docs-viewer/x-nav-list}}
66-
{{/each-in}}
67-
{{/docs-viewer/x-nav-list}}
44+
{{#each items as |item|}}
45+
{{docs-viewer/x-nav-item (break-on item.name '/') (concat root '.api.item') item.path}}
46+
{{/each}}
47+
{{/each-in}}
6848
{{/if}}
6949
{{/docs-viewer/x-nav-list}}
7050

addon/components/docs-viewer/x-page-index/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<nav class="hidden lg:block lg:w-1/5 pl-4" data-test-page-index>
2-
<div class="sticky pin-t pt-4 -mt-4 max-h-screen overflow-y-scroll">
2+
<div class="sticky pin-t pt-4 pb-8 -mt-4 max-h-screen overflow-y-scroll">
33
<ul class="list-reset border-l border-grey-lighter pl-6 leading-normal">
44
{{#if pageIndex.length}}
55
<li class="mt-20 text-grey font-bold tracking-wide uppercase text-xs">

addon/components/docs-viewer/x-section/component.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import Component from '@ember/component';
2-
import layout from './template';
2+
import hbs from 'htmlbars-inline-precompile';
33

44
export default Component.extend({
5+
tagName: '',
56

6-
layout,
7-
8-
tagName: ''
9-
7+
layout: hbs`
8+
<li class='
9+
mt-8 text-grey font-bold
10+
tracking-wide uppercase
11+
{{if (eq style 'large') '-mb-4 text-sm' 'text-xs'}}
12+
'>
13+
{{label}}
14+
</li>
15+
`
1016
}).reopenClass({
1117

1218
positionalParams: [ 'label' ]

addon/components/docs-viewer/x-section/template.hbs

Lines changed: 0 additions & 7 deletions
This file was deleted.

addon/helpers/break-on.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { helper } from '@ember/component/helper';
2+
3+
/**
4+
Helper function that inserts zero-width spaces after the break character, so
5+
that the string will break when wrapping only after that character.
6+
7+
@hide
8+
*/
9+
export function breakOn([string, breakChar]) {
10+
return string.replace(new RegExp(breakChar, 'g'), `${breakChar}\u200B`)
11+
}
12+
13+
export default helper(breakOn);

addon/router.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
1+
/** @documenter yuidoc */
2+
13
import EmberRouter from '@ember/routing/router';
24
import RouterScroll from 'ember-router-scroll';
35

6+
/**
7+
The AddonDocsRouter, which adds some extra functionality. This should be used
8+
instead of the standard EmberRouter class in your docs app.
9+
10+
```js
11+
import AddonDocsRouter, { docsRoute } from 'ember-cli-addon-docs/router';
12+
import config from './config/environment';
13+
14+
const Router = AddonDocsRouter.extend({
15+
location: config.locationType,
16+
rootURL: config.rootURL,
17+
});
18+
```
19+
20+
@class AddonDocsRouter
21+
@extends EmberRouter
22+
*/
423
export default EmberRouter.extend(RouterScroll);
524

25+
/**
26+
Creates the docs route and api docs routes. Can receive a callback with the
27+
routes you want to add to your docs.
28+
29+
```js
30+
import AddonDocsRouter, { docsRoute } from 'ember-cli-addon-docs/router';
31+
32+
Router.map(function() {
33+
docsRoute(this, function() {
34+
this.route('usage');
35+
});
36+
});
37+
```
38+
39+
@function docsRoute
40+
*/
641
export function docsRoute(router, callback) {
742
router.route('docs', function() {
843
callback.apply(this);

0 commit comments

Comments
 (0)