blob: f7929c28f5121073f99bea49c1c78000e2bd83eb [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">
Dixsie Wolmersd4a5d6f2019-11-17 18:21:50 -060035 </icon>
36 <icon ng-if="$ctrl.status === 'loading'"
37 file="icon-loader.svg"
38 aria-hidden="true"
39 class="icon__loader icon__loader-sm">
40 </icon>
41 `
Yoshie Muranaka4b366b52019-09-24 08:32:42 -070042
43 /**
44 * Register statusIcon component
45 */
46 angular.module('app.common.components')
47 .component('statusIcon', {template, bindings: {status: '@'}})
48})(window.angular);