Skip to content

Commit 5ef28a6

Browse files
committed
make import-example use the same code block as markdown
1 parent e1ed1c6 commit 5ef28a6

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

Diff for: app/components/import-example.hbs

+1-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
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>
1+
<MarkdownToHtml @markdown={{this.markdown}} />

Diff for: app/components/import-example.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import { action } from '@ember/object';
21
import Component from '@glimmer/component';
3-
import { later } from '@ember/runloop';
4-
import { tracked } from '@glimmer/tracking';
52

63
export default class ImportExample extends Component {
7-
@tracked showClipboardSuccessIcon = false;
8-
9-
@action
10-
showSuccess() {
11-
this.showClipboardSuccessIcon = true;
12-
later(this, () => (this.showClipboardSuccessIcon = false), 950);
4+
get markdown() {
5+
let md = `\`\`\`js
6+
import ${this.args.item} from '${this.args.package}';
7+
\`\`\``;
8+
return md;
139
}
1410
}

0 commit comments

Comments
 (0)