2018-09-25 16:28:26 +00:00
|
|
|
import { camelize } from '@ember/string';
|
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
2018-04-03 14:16:57 +00:00
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
|
|
|
|
const GLYPHS_WITH_SVG_TAG = [
|
2018-08-28 05:03:55 +00:00
|
|
|
'learn',
|
|
|
|
'video',
|
|
|
|
'tour',
|
|
|
|
'stopwatch',
|
2018-06-26 21:35:47 +00:00
|
|
|
'download',
|
2018-04-03 14:16:57 +00:00
|
|
|
'folder',
|
|
|
|
'file',
|
2018-06-14 18:52:00 +00:00
|
|
|
'hidden',
|
2018-04-03 14:16:57 +00:00
|
|
|
'perf-replication',
|
|
|
|
'role',
|
2018-06-14 18:52:00 +00:00
|
|
|
'visible',
|
2018-04-03 14:16:57 +00:00
|
|
|
'information-reversed',
|
|
|
|
'true',
|
|
|
|
'false',
|
2018-07-19 01:59:04 +00:00
|
|
|
'upload',
|
|
|
|
'control-lock',
|
2018-08-15 19:41:43 +00:00
|
|
|
'edition-enterprise',
|
2018-08-28 05:03:55 +00:00
|
|
|
'edition-oss',
|
2018-10-18 19:19:50 +00:00
|
|
|
'check-plain',
|
|
|
|
'check-circle-fill',
|
2018-10-10 04:35:33 +00:00
|
|
|
'cancel-square-outline',
|
2018-10-21 19:19:34 +00:00
|
|
|
'status-indicator',
|
|
|
|
'person',
|
|
|
|
'console',
|
|
|
|
'checkmark-circled-outline',
|
|
|
|
'close-circled-outline',
|
|
|
|
'neutral-circled-outline',
|
2018-04-03 14:16:57 +00:00
|
|
|
];
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Component.extend({
|
2018-04-03 14:16:57 +00:00
|
|
|
layout: hbs`
|
|
|
|
{{#if excludeSVG}}
|
|
|
|
{{partial partialName}}
|
|
|
|
{{else}}
|
|
|
|
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="{{size}}" height="{{size}}" viewBox="0 0 512 512">
|
|
|
|
{{partial partialName}}
|
|
|
|
</svg>
|
|
|
|
{{/if}}
|
|
|
|
`,
|
|
|
|
|
|
|
|
tagName: 'span',
|
|
|
|
excludeIconClass: false,
|
|
|
|
classNameBindings: ['excludeIconClass::icon'],
|
|
|
|
classNames: ['has-current-color-fill'],
|
|
|
|
|
|
|
|
attributeBindings: ['aria-label', 'aria-hidden'],
|
|
|
|
|
|
|
|
glyph: null,
|
|
|
|
|
|
|
|
excludeSVG: computed('glyph', function() {
|
2018-08-28 05:03:55 +00:00
|
|
|
let glyph = this.get('glyph');
|
|
|
|
return glyph.startsWith('enable/') || GLYPHS_WITH_SVG_TAG.includes(glyph);
|
2018-04-03 14:16:57 +00:00
|
|
|
}),
|
|
|
|
|
2018-08-28 05:03:55 +00:00
|
|
|
size: computed('glyph', function() {
|
|
|
|
return this.get('glyph').startsWith('enable/') ? 48 : 12;
|
2018-04-03 14:16:57 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
partialName: computed('glyph', function() {
|
|
|
|
const glyph = this.get('glyph');
|
2018-09-25 16:28:26 +00:00
|
|
|
return `svg/icons/${camelize(glyph)}`;
|
2018-04-03 14:16:57 +00:00
|
|
|
}),
|
|
|
|
});
|