Skip to content

Commit 3c4bb40

Browse files
authored
Merge branch 'master' into update-table-of-contents-component-to-glimmer
2 parents 0acb8de + 5d71de4 commit 3c4bb40

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

app/components/import-example.hbs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div class='highlight javascript'>
2+
<div class='ribbon'></div>
3+
{{#if (is-clipboard-supported)}}
4+
<div class='import-copy'>
5+
{{#if this.showClipboardSuccessIcon}}
6+
{{svg-jar 'success' width='24px' height='24px'}}
7+
{{else}}
8+
<CopyButton @clipboardText={{concat 'import ' @item " from '" @package "';"}} @title='Copy to clipboard' @success={{this.showSuccess}}>
9+
{{svg-jar 'copy' width='24px' height='24px'}}
10+
</CopyButton>
11+
{{/if}}
12+
</div>
13+
{{/if}}
14+
<table class='CodeRay'>
15+
<tbody>
16+
<tr>
17+
<td class='code'><pre><span class='wrapper'><span class='keyword'>import</span> {{@item}} <span class='keyword'>from</span> <span class='string'>'{{@package}}'</span>;</span></pre></td>
18+
</tr>
19+
</tbody>
20+
</table>
21+
</div>

app/components/import-example.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
/* eslint-disable ember/classic-decorator-no-classic-methods */
21
import { action } from '@ember/object';
3-
import Component from '@ember/component';
2+
import Component from '@glimmer/component';
43
import { later } from '@ember/runloop';
4+
import { tracked } from '@glimmer/tracking';
55

66
export default class ImportExample extends Component {
7+
@tracked showClipboardSuccessIcon = false;
8+
79
@action
810
showSuccess() {
9-
this.toggleProperty('showClipboardSuccessIcon');
10-
later(this, () => this.toggleProperty('showClipboardSuccessIcon'), 950);
11+
this.showClipboardSuccessIcon = true;
12+
later(this, () => (this.showClipboardSuccessIcon = false), 950);
1113
}
1214
}

app/templates/components/import-example.hbs

-21
This file was deleted.

tests/integration/components/import-example-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ module('Integration | Component | import example', function (hooks) {
88

99
test('it renders a class import example', async function (assert) {
1010
await render(
11-
hbs`{{import-example item='Application' package='@ember/application'}}`
11+
hbs`<ImportExample @item='Application' @package='@ember/application'/>`
1212
);
1313
assert.dom('*').hasText("import Application from '@ember/application';");
1414
});
1515

1616
test('it renders a function import example', async function (assert) {
1717
await render(
18-
hbs`{{import-example item='{ uniqBy }' package='@ember/object/computed'}}`
18+
hbs`<ImportExample @item='{ uniqBy }' @package='@ember/object/computed'/>`
1919
);
2020
assert.dom('*').hasText("import { uniqBy } from '@ember/object/computed';");
2121
});

0 commit comments

Comments
 (0)