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

Inline symbolset option #430

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
22 changes: 8 additions & 14 deletions addon/components/au-icon.hbs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<svg
role="img"
class="au-c-icon au-c-icon--{{@icon}} {{this.alignment}} {{this.size}}"
aria-hidden="{{if
(or (eq @ariaHidden false) (eq @ariaHidden 'false'))
'false'
'true'
}}"
...attributes
>
<use
xlink:href="{{this.iconPrefix}}@appuniversum/ember-appuniversum/appuniversum-symbolset.svg#{{@icon}}"
></use>
</svg>
<span class="au-c-icon {{this.alignment}} {{this.size}}" ...attributes>
{{svg-jar
@icon
role="img"
class="au-c-icon__svg"
aria-hidden=this.ariaHiddenAttribute
}}
</span>
18 changes: 12 additions & 6 deletions addon/components/au-icon.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import Component from '@glimmer/component';
import { getOwner } from '@ember/application';

export default class AuButton extends Component {
get iconPrefix() {
const config = getOwner(this).resolveRegistration('config:environment');

return config.rootURL || '/';
export default class AuIcon extends Component {
get icon() {
return `#${this.args.icon}`;
}

get size() {
if (this.args.size == 'large') return 'au-c-icon--large';
if (this.args.size == 'medium') return 'au-c-icon--medium';
else return '';
}

Expand All @@ -18,4 +16,12 @@ export default class AuButton extends Component {
if (this.args.alignment == 'right') return 'au-c-icon--right';
else return '';
}

get ariaHiddenAttribute() {
if (this.args.ariaHidden === false || this.args.ariaHidden === 'false') {
return 'false';
} else {
return 'true';
}
}
}
3 changes: 3 additions & 0 deletions addon/components/au-symbols.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="au-c-symbols au-u-hidden-visually" aria-hidden="true">
<AuSymbols::Content />
</div>
11 changes: 10 additions & 1 deletion app/styles/ember-appuniversum/_c-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ $au-icon-size-large: var(--au-icon-size-large) !default;
fill: currentColor;
}

.au-c-icon__svg {
display: block;
width: inherit;
height: inherit;
position: relative;
stroke-width: 0;
stroke: inherit;
fill: inherit;
}

/* Modifiers
========================================================================== */

.au-c-icon--medium {
width: $au-icon-size-medium;
height: $au-icon-size-medium;
Expand Down
4 changes: 4 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ module.exports = function (defaults) {
// https://github.com/storybookjs/ember-cli-storybook/issues/158
enabled: false,
},
svgJar: {
strategy: ['inline'],
sourceDirs: ['public/icons'],
},
});

/*
Expand Down
Loading