Skip to content

Commit dba27d4

Browse files
authored
Merge pull request #509 from ember-learn/svg-jar
stop using svg-jar
2 parents 3f7a9a4 + c0c300c commit dba27d4

32 files changed

+271
-1011
lines changed

addon/components/es-card-content.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{!-- Bug link: https://github.com/ember-template-lint/ember-template-lint/issues/1286 --}}
33

44
{{#if @icon}}
5-
{{svg-jar @icon class="card__icon" width="60px"}}
5+
<EsIcon @icon={{@icon}} @class="card__icon" width="60px" />
66
{{/if}}
77

88
{{#if @image}}

addon/components/es-footer-contributions.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="sponsor-icons">
55
{{#each @contributorLinks as |link|}}
66
<a href={{link.href}} title={{link.title}} aria-label={{link.title}} class="mr-2">
7-
{{svg-jar link.class class="footer-contributor-logo"}}
7+
<EsIcon @icon={{link.class}} @class="footer-contributor-logo" />
88
</a>
99
{{/each}}
1010
</div>

addon/components/es-footer-info.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<div class="footer-social hide-on-mobile">
1313
{{#each @socialLinks as |link|}}
1414
<a href={{link.href}} title={{link.title}} aria-label={{link.label}} rel="me">
15-
{{svg-jar link.class}} {{link.title}}
15+
<EsIcon @icon={{link.class}} /> {{link.title}}
1616
</a>
1717
{{/each}}
1818
</div>

addon/components/es-footer-statement.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{{@tagline}}
66
{{#if @contributeLink}}
77
<br>
8-
<a href={{@contributeLink}}>Contribute to this page {{svg-jar 'external-link'}}</a>
8+
<a href={{@contributeLink}}>Contribute to this page <EsIcon @icon="external-link" /></a>
99
{{/if}}
1010
</p>
1111
</div>

addon/components/es-icon.hbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{!-- template-lint-disable no-triple-curlies --}}
2+
{{{this.icon}}}

addon/components/es-icon.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Component from '@glimmer/component';
2+
import { assert } from '@ember/debug';
3+
4+
import icons from '../constants/icons';
5+
6+
export default class EsIconComponent extends Component {
7+
get icon() {
8+
if (!(this.args.icon in icons)) {
9+
assert(
10+
`${
11+
this.args.icon
12+
} isn't a supported icon. We no longer support dynamid svg lookup and can only support the following icons: ${Object.keys(
13+
icons
14+
).join(', ')}`
15+
);
16+
}
17+
18+
return icons[this.args.icon].replace(
19+
'<svg ',
20+
`<svg class="${this.args.class}"`
21+
);
22+
}
23+
}

addon/components/es-pagination.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<div class="pagination-wrapper">
22
{{#if (and (has-block "previous") @showPrevious)}}
33
<div class="previous-wrapper">
4-
<img alt="left arrow" src="/images/icons/arrow-icon.svg" />
4+
<img alt="left arrow" src="/images/arrow-icon.svg" />
55
<div>{{yield to='previous'}}</div>
66
</div>
77
{{/if}}
88

99
{{#if (and (has-block "next") @showNext)}}
1010
<div class="next-wrapper">
1111
<div>{{yield to='next'}}</div>
12-
<img alt="right arrow" src="/images/icons/arrow-icon.svg" />
12+
<img alt="right arrow" src="/images/arrow-icon.svg" />
1313
</div>
1414
{{/if}}
1515
</div>

addon/components/es-sidebar.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@type="button"
77
@onClicked={{this.close}}
88
>
9-
{{svg-jar "close-icon"}}
9+
<svg width="36" height="36" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg"><path d="M12.343 10.929L18 16.585l5.657-5.656a1 1 0 011.414 1.414L19.415 18l5.656 5.657a1 1 0 01-1.414 1.414L18 19.415l-5.657 5.656a1 1 0 01-1.414-1.414L16.585 18l-5.656-5.657a1 1 0 011.414-1.414z" fill="#FFF" fill-rule="evenodd"/></svg>
1010
</EsButton>
1111
<div class="es-sidebar-content">
1212
{{yield}}
@@ -19,5 +19,5 @@
1919
@type="button"
2020
@onClicked={{this.toggle}}
2121
>
22-
{{svg-jar "sidebar-icon" aria-hidden="true"}}
22+
<svg aria-hidden="true" width="36" height="36" viewBox="0 0 36 36" xmlns="http://www.w3.org/2000/svg"><g fill="#FFF" fill-rule="evenodd"><path d="M28 24.5a1 1 0 010 2H13a1 1 0 010-2h15zm0-7a1 1 0 010 2H13a1 1 0 010-2h15zm0-7a1 1 0 010 2H13a1 1 0 010-2h15zM9 24a1.5 1.5 0 110 3 1.5 1.5 0 010-3zm0-7a1.5 1.5 0 110 3 1.5 1.5 0 010-3zm0-7a1.5 1.5 0 110 3 1.5 1.5 0 010-3z"/></g></svg>
2323
</EsButton>

addon/constants/icons.js

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/es-icon.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from 'ember-styleguide/components/es-icon';

index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,7 @@ const staticPostcssAddonTree = require('static-postcss-addon-tree');
77
module.exports = {
88
name: require('./package').name,
99

10-
options: {
11-
svgJar: {
12-
sourceDirs: [
13-
'public/images/icons',
14-
'node_modules/ember-styleguide/public/images/icons',
15-
'tests/dummy/public/images/icons'
16-
]
17-
},
18-
},
10+
options: {},
1911

2012
treeForAddon() {
2113
var tree = this._super(...arguments);

0 commit comments

Comments
 (0)