summaryrefslogtreecommitdiffstats
path: root/public/src/app/api/feather-pipe.ts
blob: 7a0715dda22dcbc59ee72399a31ab1008740e5f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
      })
    );
  }
}