1 | import { Component, Input } from '@angular/core';
|
---|
2 | import { FaIconComponent } from './icon.component';
|
---|
3 | export class FaDuotoneIconComponent extends FaIconComponent {
|
---|
4 | findIconDefinition(i) {
|
---|
5 | const definition = super.findIconDefinition(i);
|
---|
6 | if (definition != null && !Array.isArray(definition.icon[4])) {
|
---|
7 | throw new Error('The specified icon does not appear to be a Duotone icon. ' +
|
---|
8 | 'Check that you specified the correct style: ' +
|
---|
9 | `<fa-duotone-icon [icon]="['fad', '${definition.iconName}']"></fa-duotone-icon> ` +
|
---|
10 | `or use: <fa-icon icon="${definition.iconName}"></fa-icon> instead.`);
|
---|
11 | }
|
---|
12 | return definition;
|
---|
13 | }
|
---|
14 | buildParams() {
|
---|
15 | const params = super.buildParams();
|
---|
16 | if (this.swapOpacity === true || this.swapOpacity === 'true') {
|
---|
17 | params.classes.push('fa-swap-opacity');
|
---|
18 | }
|
---|
19 | if (this.primaryOpacity != null) {
|
---|
20 | params.styles['--fa-primary-opacity'] = this.primaryOpacity.toString();
|
---|
21 | }
|
---|
22 | if (this.secondaryOpacity != null) {
|
---|
23 | params.styles['--fa-secondary-opacity'] = this.secondaryOpacity.toString();
|
---|
24 | }
|
---|
25 | if (this.primaryColor != null) {
|
---|
26 | params.styles['--fa-primary-color'] = this.primaryColor;
|
---|
27 | }
|
---|
28 | if (this.secondaryColor != null) {
|
---|
29 | params.styles['--fa-secondary-color'] = this.secondaryColor;
|
---|
30 | }
|
---|
31 | return params;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | FaDuotoneIconComponent.decorators = [
|
---|
35 | { type: Component, args: [{
|
---|
36 | selector: 'fa-duotone-icon',
|
---|
37 | template: ``
|
---|
38 | },] }
|
---|
39 | ];
|
---|
40 | FaDuotoneIconComponent.propDecorators = {
|
---|
41 | swapOpacity: [{ type: Input }],
|
---|
42 | primaryOpacity: [{ type: Input }],
|
---|
43 | secondaryOpacity: [{ type: Input }],
|
---|
44 | primaryColor: [{ type: Input }],
|
---|
45 | secondaryColor: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