Yoshie Muranaka | 4b366b5 | 2019-09-24 08:32:42 -0700 | [diff] [blame] | 1 | window.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 Wolmers | d4a5d6f | 2019-11-17 18:21:50 -0600 | [diff] [blame] | 35 | </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 Muranaka | 4b366b5 | 2019-09-24 08:32:42 -0700 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * Register statusIcon component |
| 45 | */ |
| 46 | angular.module('app.common.components') |
| 47 | .component('statusIcon', {template, bindings: {status: '@'}}) |
| 48 | })(window.angular); |