diff options
Diffstat (limited to 'public/src/app/api/feather-pipe.ts')
-rw-r--r-- | public/src/app/api/feather-pipe.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/public/src/app/api/feather-pipe.ts b/public/src/app/api/feather-pipe.ts new file mode 100644 index 0000000..7a0715d --- /dev/null +++ b/public/src/app/api/feather-pipe.ts @@ -0,0 +1,19 @@ +import { DomSanitizer } from '@angular/platform-browser'; +import { Pipe, PipeTransform } from '@angular/core'; + +import * as feather from 'feather-icons/dist/feather'; + +@Pipe({ name: 'feather' }) +export class FeatherIconsPipe implements PipeTransform { + constructor(private sanitizer: DomSanitizer) {} + + transform(icon: string, size: number = 24, fill: string = 'none') { + return this.sanitizer.bypassSecurityTrustHtml( + feather.icons[icon].toSvg({ + width: size, + height: size, + fill: fill + }) + ); + } +} |