Skip to content

Commit 2b34d76

Browse files
committed
Ember v6 _ Docfy
1 parent 5bdf2b7 commit 2b34d76

77 files changed

Lines changed: 6122 additions & 573 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docfy-config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
sources: [
5+
{
6+
root: path.join(__dirname, 'docs'),
7+
pattern: '**/*.md',
8+
urlPrefix: 'docs',
9+
},
10+
],
11+
/**
12+
* Must be truthy so @docfy/ember-cli does not inject `repository` from package.json
13+
* (that enables Edit this page/demo URLs). Omit `url` so Docfy never builds edit links.
14+
*/
15+
repository: {},
16+
};

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = {
3232
// node files
3333
{
3434
files: [
35+
'./.docfy-config.js',
3536
'./.stylelintrc.js',
3637
'./.eslintrc.js',
3738
'./.prettierrc.js',

app/components/ak-clipboard/index.stories.js

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { hbs } from 'ember-cli-htmlbars';
2+
import { action } from '@ember/object';
3+
import { tracked } from '@glimmer/tracking';
24

35
export default {
46
title: 'AkClipboard',
@@ -33,27 +35,46 @@ Default.args = {
3335
},
3436
};
3537

36-
const WithTargetTemplate = (args) => ({
38+
class WithTargetContext {
39+
id = '';
40+
41+
@tracked textToCopy = 'I will be copied!';
42+
43+
@action
44+
updateTextToCopy(event) {
45+
this.textToCopy = event.target.value;
46+
}
47+
48+
@action
49+
onSuccess(event) {
50+
alert(`${event.text} is successfull.`);
51+
}
52+
53+
@action
54+
onError(event) {
55+
alert(`${event.action} errored.`);
56+
}
57+
}
58+
59+
const WithTargetTemplate = () => ({
3760
template: hbs`
38-
<AkTextField id="copy-input" value="I will be copied!" />
61+
<AkTypography @color="textSecondary" @gutterBottom={{true}}>
62+
Experiment with me
63+
</AkTypography>
64+
65+
<AkTextField
66+
id="copy-input"
67+
@value={{this.textToCopy}}
68+
{{on 'input' this.updateTextToCopy}}
69+
/>
3970
4071
<AkClipboard @id={{this.id}} @onSuccess={{this.onSuccess}} @onError={{this.onError}} as |cb|>
4172
<AkButton class="mt-2" data-clipboard-target="#copy-input" id={{cb.triggerId}}>
4273
Copy Input text
4374
</AkButton>
4475
</AkClipboard>
4576
`,
46-
context: args,
77+
context: new WithTargetContext(),
4778
});
4879

4980
export const WithTarget = WithTargetTemplate.bind({});
50-
51-
WithTarget.args = {
52-
id: '',
53-
onSuccess: (event) => {
54-
alert(`${event.text} is successfull.`);
55-
},
56-
onError: (event) => {
57-
alert(`${event.action} errored.`);
58-
},
59-
};
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<div local-class='docs-layout'>
2+
<aside local-class='docs-sidebar'>
3+
<nav local-class='docs-sidebar-nav'>
4+
<DocfyOutput @scope='docs' as |node|>
5+
{{! Top-level pages }}
6+
{{#each node.pages as |page|}}
7+
<div local-class='docs-nav-item'>
8+
<DocfyLink
9+
@to={{page.url}}
10+
@activeClass='active'
11+
local-class='docs-nav-link docs-nav-link--top'
12+
>
13+
{{page.title}}
14+
</DocfyLink>
15+
</div>
16+
{{/each}}
17+
18+
{{! Nested sections (e.g. Components) }}
19+
{{#each node.children as |child|}}
20+
<div local-class='docs-nav-section'>
21+
<div local-class='docs-nav-section-label'>
22+
{{child.label}}
23+
</div>
24+
{{#each child.pages as |page|}}
25+
<div local-class='docs-nav-item'>
26+
<DocfyLink
27+
@to={{page.url}}
28+
@activeClass='active'
29+
local-class='docs-nav-link docs-nav-link--nested'
30+
>
31+
{{page.title}}
32+
</DocfyLink>
33+
</div>
34+
{{/each}}
35+
36+
{{! Sub-sections (e.g. components/ak-button under components) }}
37+
{{#each child.children as |subChild|}}
38+
<div local-class='docs-nav-subsection'>
39+
<div local-class='docs-nav-subsection-label'>
40+
{{subChild.label}}
41+
</div>
42+
{{#each subChild.pages as |page|}}
43+
<div local-class='docs-nav-item'>
44+
<DocfyLink
45+
@to={{page.url}}
46+
@activeClass='active'
47+
local-class='docs-nav-link docs-nav-link--deep'
48+
>
49+
{{page.title}}
50+
</DocfyLink>
51+
</div>
52+
{{/each}}
53+
</div>
54+
{{/each}}
55+
</div>
56+
{{/each}}
57+
</DocfyOutput>
58+
</nav>
59+
</aside>
60+
61+
<div local-class='docs-content' {{did-insert this.setScrollContainerRef}}>
62+
<main local-class='docs-content-inner'>
63+
<div local-class='docs-prose'>
64+
{{yield}}
65+
</div>
66+
67+
<DocfyPreviousAndNextPage as |previous next|>
68+
<div local-class='docs-page-nav'>
69+
{{#if previous}}
70+
<DocfyLink @to={{previous.url}} local-class='docs-prev-link'>
71+
72+
{{previous.title}}
73+
</DocfyLink>
74+
{{else}}
75+
<span></span>
76+
{{/if}}
77+
{{#if next}}
78+
<DocfyLink @to={{next.url}} local-class='docs-next-link'>
79+
{{next.title}}
80+
81+
</DocfyLink>
82+
{{/if}}
83+
</div>
84+
</DocfyPreviousAndNextPage>
85+
</main>
86+
</div>
87+
</div>

0 commit comments

Comments
 (0)