diff --git a/package-lock.json b/package-lock.json index f8667b63b0..59550dde8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6886,6 +6886,11 @@ "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", "dev": true }, + "eva-icons": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eva-icons/-/eva-icons-1.1.0.tgz", + "integrity": "sha512-Tural3pSMSL7PoKz8zNXTwy6/0YzJqtNieYs0jTUmaVCXs7XwqFDBFfeWaPUVrKS3C5j2MsZniGOnTi3tb8b6g==" + }, "event-stream": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", @@ -12101,9 +12106,9 @@ } }, "nebular-icons": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/nebular-icons/-/nebular-icons-1.0.9.tgz", - "integrity": "sha512-zz//MW0tXGI3ArzRTqxV5ySpsRKFd5O/gy0tHYgBsjvLXe9k0UF9tS1i7cro4CB2VrrKGbZAcIo7hIPX63HCmw==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/nebular-icons/-/nebular-icons-1.1.0.tgz", + "integrity": "sha512-4TkJgDrjXw8qsOsc2NN6OBlRJYAJJpvqtjV+gpv+NV6amPgMPQNNuEvbenYXAMFmjs3uShgKOvmpnCX8Ua1oWQ==" }, "negotiator": { "version": "0.6.1", diff --git a/package.json b/package.json index 6e802b6fc5..bbc9baf142 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "classlist.js": "1.1.20150312", "core-js": "2.5.1", "echarts": "^4.0.2", + "eva-icons": "^1.1.0", "intl": "1.2.5", "ionicons": "2.0.1", "leaflet": "1.2.0", diff --git a/src/app/@theme/pipes/eva-icons.pipe.ts b/src/app/@theme/pipes/eva-icons.pipe.ts new file mode 100644 index 0000000000..91d3de04be --- /dev/null +++ b/src/app/@theme/pipes/eva-icons.pipe.ts @@ -0,0 +1,50 @@ +/** + * @license + * Copyright Akveo. All Rights Reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + */ + +import { DomSanitizer } from '@angular/platform-browser'; +import { Pipe, PipeTransform } from '@angular/core'; +import { icons } from 'eva-icons'; + +@Pipe({ name: 'eva' }) +export class EvaIconsPipe implements PipeTransform { + + private defaultOptions = { + height: 24, + width: 24, + fill: 'inherit', + animationHover: true, + animationInfinity: false, + }; + + constructor(private sanitizer: DomSanitizer) {} + + transform(icon: string, + options: { + height: number; + width: number; + fill: string; + animationType?: string; + animationHover?: boolean; + animationInfinity?: boolean; + }, + ) { + const mergedOptions = { + ...this.defaultOptions, + ...options, + }; + const { width, height, fill, animationType, animationHover, animationInfinity } = mergedOptions; + const animation = animationType ? + { type: animationType, hover: animationHover, infinite: animationInfinity } : + null; + + return this.sanitizer.bypassSecurityTrustHtml(icons[icon].toSvg({ + width, + height, + fill, + animation, + })); + } +} diff --git a/src/app/@theme/pipes/index.ts b/src/app/@theme/pipes/index.ts index 6799066df9..03f6d8cb19 100644 --- a/src/app/@theme/pipes/index.ts +++ b/src/app/@theme/pipes/index.ts @@ -3,3 +3,4 @@ export * from './plural.pipe'; export * from './round.pipe'; export * from './timing.pipe'; export * from './number-with-commas.pipe'; +export * from './eva-icons.pipe'; diff --git a/src/app/@theme/theme.module.ts b/src/app/@theme/theme.module.ts index 2da490ef32..9cba96f3e2 100644 --- a/src/app/@theme/theme.module.ts +++ b/src/app/@theme/theme.module.ts @@ -57,6 +57,7 @@ import { RoundPipe, TimingPipe, NumberWithCommasPipe, + EvaIconsPipe, } from './pipes'; import { OneColumnLayoutComponent, @@ -132,6 +133,7 @@ const PIPES = [ RoundPipe, TimingPipe, NumberWithCommasPipe, + EvaIconsPipe, ]; const NB_THEME_PROVIDERS = [ diff --git a/src/app/pages/ui-features/icons/icons.component.html b/src/app/pages/ui-features/icons/icons.component.html index 0aedaf9d60..3a5b5e0ad2 100644 --- a/src/app/pages/ui-features/icons/icons.component.html +++ b/src/app/pages/ui-features/icons/icons.component.html @@ -1,4 +1,22 @@
+
+ + + Eva Icons + + +
+ + + +
+
+ + See all eva-icons + +
+
+
@@ -28,9 +46,7 @@ -
-
Ionicons @@ -41,8 +57,9 @@
- See all ionicons icons + See all ionicons +
diff --git a/src/app/pages/ui-features/icons/icons.component.ts b/src/app/pages/ui-features/icons/icons.component.ts index 89ed70c926..b97b3bdf3d 100644 --- a/src/app/pages/ui-features/icons/icons.component.ts +++ b/src/app/pages/ui-features/icons/icons.component.ts @@ -1,12 +1,20 @@ -import { Component } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { icons } from 'eva-icons'; @Component({ selector: 'ngx-icons', styleUrls: ['./icons.component.scss'], templateUrl: './icons.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, }) export class IconsComponent { + evaIcons = []; + + constructor() { + this.evaIcons = Object.keys(icons).filter(icon => icon.indexOf('outline') === -1); + } + icons = { nebular: ['nb-alert', 'nb-angle-double-left', 'nb-angle-double-right',