Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 1 | <template> |
| 2 | <span :class="['status-icon', status]"> |
| 3 | <icon-success v-if="status === 'success'" /> |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 4 | <icon-warning v-else-if="status === 'warning'" /> |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 5 | <icon-danger v-else-if="status === 'danger'" /> |
| 6 | <icon-secondary v-else /> |
| 7 | </span> |
| 8 | </template> |
| 9 | |
| 10 | <script> |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 11 | import IconCheckmark from '@carbon/icons-vue/es/checkmark--filled/20'; |
| 12 | import IconWarning from '@carbon/icons-vue/es/warning--filled/20'; |
| 13 | import IconError from '@carbon/icons-vue/es/error--filled/20'; |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 14 | |
| 15 | export default { |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 16 | name: 'StatusIcon', |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 17 | components: { |
| 18 | iconSuccess: IconCheckmark, |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 19 | iconDanger: IconError, |
| 20 | iconSecondary: IconError, //TODO: swap with right asset when available |
| 21 | iconWarning: IconWarning |
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 22 | }, |
| 23 | props: { |
| 24 | status: { |
| 25 | type: String, |
| 26 | default: '' |
| 27 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 28 | } |
| 29 | }; |
| 30 | </script> |
| 31 | |
| 32 | <style lang="scss" scoped> |
| 33 | .status-icon { |
| 34 | vertical-align: text-bottom; |
| 35 | &.success { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame^] | 36 | fill: theme-color('success'); |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 37 | } |
| 38 | &.danger { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame^] | 39 | fill: theme-color('danger'); |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 40 | } |
| 41 | &.secondary { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame^] | 42 | fill: gray('600'); |
Derick Montague | 7f970a1 | 2020-03-02 17:56:09 -0600 | [diff] [blame] | 43 | |
| 44 | svg { |
| 45 | transform: rotate(-45deg); |
| 46 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 47 | } |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 48 | &.warning { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame^] | 49 | fill: theme-color('warning'); |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 50 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 51 | } |
| 52 | </style> |