Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop using svg-jar #509

Merged
merged 4 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/components/es-card-content.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{!-- Bug link: https://github.com/ember-template-lint/ember-template-lint/issues/1286 --}}

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

{{#if @image}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/es-footer-contributions.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="sponsor-icons">
{{#each @contributorLinks as |link|}}
<a href={{link.href}} title={{link.title}} aria-label={{link.title}} class="mr-2">
{{svg-jar link.class class="footer-contributor-logo"}}
<EsIcon @icon={{link.class}} @class="footer-contributor-logo" />
</a>
{{/each}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/es-footer-info.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="footer-social hide-on-mobile">
{{#each @socialLinks as |link|}}
<a href={{link.href}} title={{link.title}} aria-label={{link.label}} rel="me">
{{svg-jar link.class}} {{link.title}}
<EsIcon @icon={{link.class}} /> {{link.title}}
</a>
{{/each}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/es-footer-statement.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{@tagline}}
{{#if @contributeLink}}
<br>
<a href={{@contributeLink}}>Contribute to this page {{svg-jar 'external-link'}}</a>
<a href={{@contributeLink}}>Contribute to this page <EsIcon @icon="external-link" /></a>
{{/if}}
</p>
</div>
1 change: 1 addition & 0 deletions addon/components/es-icon.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{{this.icon}}}

Check failure on line 1 in addon/components/es-icon.hbs

View workflow job for this annotation

GitHub Actions / Tests

Usage of triple curly brackets is unsafe
23 changes: 23 additions & 0 deletions addon/components/es-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Component from '@glimmer/component';
import { assert } from '@ember/debug';

import icons from '../constants/icons';

export default class EsIconComponent extends Component {
get icon() {
if (!(this.args.icon in icons)) {
assert(
`${
this.args.icon
} isn't a supported icon. We no longer support dynamid svg lookup and can only support the following icons: ${Object.keys(
icons
).join(', ')}`
);
}

return icons[this.args.icon].replace(
'<svg ',
`<svg class="${this.args.class}"`
);
}
}
4 changes: 2 additions & 2 deletions addon/components/es-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@type="button"
@onClicked={{this.close}}
>
{{svg-jar "close-icon"}}
<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>
</EsButton>
<div class="es-sidebar-content">
{{yield}}
Expand All @@ -19,5 +19,5 @@
@type="button"
@onClicked={{this.toggle}}
>
{{svg-jar "sidebar-icon" aria-hidden="true"}}
<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>
</EsButton>
86 changes: 86 additions & 0 deletions addon/constants/icons.js
mansona marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/components/es-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'ember-styleguide/components/es-icon';

Check failure on line 1 in app/components/es-icon.js

View workflow job for this annotation

GitHub Actions / Tests

Insert `⏎`
Loading
Loading