Skip to content

Commit b3d7b7b

Browse files
authored
feat: add eva-icons (#1912)
1 parent 3f1f4c5 commit b3d7b7b

File tree

7 files changed

+91
-7
lines changed

7 files changed

+91
-7
lines changed

Diff for: package-lock.json

+8-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"classlist.js": "1.1.20150312",
6262
"core-js": "2.5.1",
6363
"echarts": "^4.0.2",
64+
"eva-icons": "^1.1.0",
6465
"intl": "1.2.5",
6566
"ionicons": "2.0.1",
6667
"leaflet": "1.2.0",

Diff for: src/app/@theme/pipes/eva-icons.pipe.ts

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* @license
3+
* Copyright Akveo. All Rights Reserved.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*/
6+
7+
import { DomSanitizer } from '@angular/platform-browser';
8+
import { Pipe, PipeTransform } from '@angular/core';
9+
import { icons } from 'eva-icons';
10+
11+
@Pipe({ name: 'eva' })
12+
export class EvaIconsPipe implements PipeTransform {
13+
14+
private defaultOptions = {
15+
height: 24,
16+
width: 24,
17+
fill: 'inherit',
18+
animationHover: true,
19+
animationInfinity: false,
20+
};
21+
22+
constructor(private sanitizer: DomSanitizer) {}
23+
24+
transform(icon: string,
25+
options: {
26+
height: number;
27+
width: number;
28+
fill: string;
29+
animationType?: string;
30+
animationHover?: boolean;
31+
animationInfinity?: boolean;
32+
},
33+
) {
34+
const mergedOptions = {
35+
...this.defaultOptions,
36+
...options,
37+
};
38+
const { width, height, fill, animationType, animationHover, animationInfinity } = mergedOptions;
39+
const animation = animationType ?
40+
{ type: animationType, hover: animationHover, infinite: animationInfinity } :
41+
null;
42+
43+
return this.sanitizer.bypassSecurityTrustHtml(icons[icon].toSvg({
44+
width,
45+
height,
46+
fill,
47+
animation,
48+
}));
49+
}
50+
}

Diff for: src/app/@theme/pipes/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './plural.pipe';
33
export * from './round.pipe';
44
export * from './timing.pipe';
55
export * from './number-with-commas.pipe';
6+
export * from './eva-icons.pipe';

Diff for: src/app/@theme/theme.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
RoundPipe,
5858
TimingPipe,
5959
NumberWithCommasPipe,
60+
EvaIconsPipe,
6061
} from './pipes';
6162
import {
6263
OneColumnLayoutComponent,
@@ -132,6 +133,7 @@ const PIPES = [
132133
RoundPipe,
133134
TimingPipe,
134135
NumberWithCommasPipe,
136+
EvaIconsPipe,
135137
];
136138

137139
const NB_THEME_PROVIDERS = [

Diff for: src/app/pages/ui-features/icons/icons.component.html

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
<div class="row">
2+
<div class="col-md-12 col-lg-6">
3+
<nb-card>
4+
<nb-card-header>
5+
Eva Icons
6+
</nb-card-header>
7+
<nb-card-body>
8+
<div class="icon" *ngFor="let icon of evaIcons">
9+
<i [nbPopover]="icon">
10+
<i [innerHTML]="icon | eva: { fill: '#d1d1ff', animationType: 'pulse' }"></i>
11+
</i>
12+
</div>
13+
</nb-card-body>
14+
<nb-card-footer>
15+
<a href="https://akveo.github.io/eva-icons/" target="_blank">See all eva-icons</a>
16+
</nb-card-footer>
17+
</nb-card>
18+
</div>
19+
220
<div class="col-md-12 col-lg-6">
321
<nb-card class="nb-icons">
422
<nb-card-header>
@@ -28,9 +46,7 @@
2846
</a>
2947
</nb-card-footer>
3048
</nb-card>
31-
</div>
3249

33-
<div class="col-md-12 col-lg-6">
3450
<nb-card>
3551
<nb-card-header>
3652
Ionicons
@@ -41,8 +57,9 @@
4157
</div>
4258
</nb-card-body>
4359
<nb-card-footer>
44-
<a href="http://ionicons.com/" target="_blank">See all ionicons icons</a>
60+
<a href="http://ionicons.com/" target="_blank">See all ionicons</a>
4561
</nb-card-footer>
4662
</nb-card>
63+
4764
</div>
4865
</div>

Diff for: src/app/pages/ui-features/icons/icons.component.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
import { Component } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component } from '@angular/core';
2+
import { icons } from 'eva-icons';
23

34
@Component({
45
selector: 'ngx-icons',
56
styleUrls: ['./icons.component.scss'],
67
templateUrl: './icons.component.html',
8+
changeDetection: ChangeDetectionStrategy.OnPush,
79
})
810
export class IconsComponent {
911

12+
evaIcons = [];
13+
14+
constructor() {
15+
this.evaIcons = Object.keys(icons).filter(icon => icon.indexOf('outline') === -1);
16+
}
17+
1018
icons = {
1119

1220
nebular: ['nb-alert', 'nb-angle-double-left', 'nb-angle-double-right',

0 commit comments

Comments
 (0)