blob: d7563265b04f2f6ed0ea8a5c9aee36fe9d22698a [file] [log] [blame]
Yoshie Muranaka4b366b52019-09-24 08:32:42 -07001window.angular && (function(angular) {
2 'use strict';
3
4 /**
5 * statusIcon Component
6 *
7 * To use:
8 * The <status-icon> component expects a 'status' attribute
9 * with a status value (on, off, warn, error)
10 *
11 */
12
13 /**
14 * statusIcon Component template
15 */
16 const template = `<icon ng-if="$ctrl.status === 'on'"
17 file="icon-on.svg"
18 aria-hidden="true"
19 class="status-icon">
20 </icon>
21 <icon ng-if="$ctrl.status === 'off'"
22 file="icon-off.svg"
23 aria-hidden="true"
24 class="status-icon">
25 </icon>
26 <icon ng-if="$ctrl.status === 'warn'"
27 file="icon-warning.svg"
28 aria-hidden="true"
29 class="status-icon">
30 </icon>
31 <icon ng-if="$ctrl.status === 'error'"
32 file="icon-critical.svg"
33 aria-hidden="true"
34 class="status-icon">
35 </icon>`
36
37 /**
38 * Register statusIcon component
39 */
40 angular.module('app.common.components')
41 .component('statusIcon', {template, bindings: {status: '@'}})
42})(window.angular);