aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/images/global-icon.component.ts
blob: a56674b58f2da0964d4680224cf08542701e4b62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core'

const icons = {
  'add': require('!!raw-loader?!../../../assets/images/global/add.svg'),
  'user': require('!!raw-loader?!../../../assets/images/global/user.svg'),
  'sign-out': require('!!raw-loader?!../../../assets/images/global/sign-out.svg'),
  'syndication': require('!!raw-loader?!../../../assets/images/global/syndication.svg'),
  'help': require('!!raw-loader?!../../../assets/images/global/help.svg'),
  'sparkle': require('!!raw-loader?!../../../assets/images/global/sparkle.svg'),
  'alert': require('!!raw-loader?!../../../assets/images/global/alert.svg'),
  'cloud-error': require('!!raw-loader?!../../../assets/images/global/cloud-error.svg'),
  'user-add': require('!!raw-loader?!../../../assets/images/global/user-add.svg'),
  'no': require('!!raw-loader?!../../../assets/images/global/no.svg'),
  'cloud-download': require('!!raw-loader?!../../../assets/images/global/cloud-download.svg'),
  'undo': require('!!raw-loader?!../../../assets/images/global/undo.svg'),
  'history': require('!!raw-loader?!../../../assets/images/global/history.svg'),
  'circle-tick': require('!!raw-loader?!../../../assets/images/global/circle-tick.svg'),
  'cog': require('!!raw-loader?!../../../assets/images/global/cog.svg'),
  'download': require('!!raw-loader?!../../../assets/images/global/download.svg'),
  'go': require('!!raw-loader?!../../../assets/images/menu/go.svg'),
  'edit': require('!!raw-loader?!../../../assets/images/global/edit.svg'),
  'im-with-her': require('!!raw-loader?!../../../assets/images/global/im-with-her.svg'),
  'delete': require('!!raw-loader?!../../../assets/images/global/delete.svg'),
  'server': require('!!raw-loader?!../../../assets/images/global/server.svg'),
  'cross': require('!!raw-loader?!../../../assets/images/global/cross.svg'),
  'validate': require('!!raw-loader?!../../../assets/images/global/validate.svg'),
  'tick': require('!!raw-loader?!../../../assets/images/global/tick.svg'),
  'dislike': require('!!raw-loader?!../../../assets/images/video/dislike.svg'),
  'heart': require('!!raw-loader?!../../../assets/images/video/heart.svg'),
  'like': require('!!raw-loader?!../../../assets/images/video/like.svg'),
  'more-horizontal': require('!!raw-loader?!../../../assets/images/global/more-horizontal.svg'),
  'more-vertical': require('!!raw-loader?!../../../assets/images/global/more-vertical.svg'),
  'share': require('!!raw-loader?!../../../assets/images/video/share.svg'),
  'upload': require('!!raw-loader?!../../../assets/images/video/upload.svg'),
  'playlist-add': require('!!raw-loader?!../../../assets/images/video/playlist-add.svg'),
  'play': require('!!raw-loader?!../../../assets/images/global/play.svg'),
  'playlists': require('!!raw-loader?!../../../assets/images/global/playlists.svg'),
  'about': require('!!raw-loader?!../../../assets/images/menu/about.svg'),
  'globe': require('!!raw-loader?!../../../assets/images/menu/globe.svg'),
  'home': require('!!raw-loader?!../../../assets/images/menu/home.svg'),
  'recently-added': require('!!raw-loader?!../../../assets/images/menu/recently-added.svg'),
  'trending': require('!!raw-loader?!../../../assets/images/menu/trending.svg'),
  'videos': require('!!raw-loader?!../../../assets/images/global/videos.svg'),
  'folder': require('!!raw-loader?!../../../assets/images/global/folder.svg'),
  'administration': require('!!raw-loader?!../../../assets/images/menu/administration.svg'),
  'subscriptions': require('!!raw-loader?!../../../assets/images/menu/subscriptions.svg'),
  'users': require('!!raw-loader?!../../../assets/images/global/users.svg'),
  'search': require('!!raw-loader?!../../../assets/images/global/search.svg'),
  'refresh': require('!!raw-loader?!../../../assets/images/global/refresh.svg')
}

export type GlobalIconName = keyof typeof icons

@Component({
  selector: 'my-global-icon',
  template: '',
  styleUrls: [ './global-icon.component.scss' ],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class GlobalIconComponent implements OnInit {
  @Input() iconName: GlobalIconName

  constructor (private el: ElementRef) {}

  ngOnInit () {
    const nativeElement = this.el.nativeElement

    nativeElement.innerHTML = icons[this.iconName]
  }
}