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'; |
Sukanya Pandey | b2ca0c0 | 2020-07-20 23:23:29 +0530 | [diff] [blame] | 14 | import IconMisuse from '@carbon/icons-vue/es/misuse/20'; |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 15 | |
| 16 | export default { |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 17 | name: 'StatusIcon', |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 18 | components: { |
| 19 | iconSuccess: IconCheckmark, |
Sukanya Pandey | b2ca0c0 | 2020-07-20 23:23:29 +0530 | [diff] [blame] | 20 | iconDanger: IconMisuse, |
| 21 | iconSecondary: IconError, |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 22 | iconWarning: IconWarning |
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 23 | }, |
| 24 | props: { |
| 25 | status: { |
| 26 | type: String, |
| 27 | default: '' |
| 28 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 29 | } |
| 30 | }; |
| 31 | </script> |
| 32 | |
| 33 | <style lang="scss" scoped> |
| 34 | .status-icon { |
| 35 | vertical-align: text-bottom; |
| 36 | &.success { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 37 | fill: theme-color('success'); |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 38 | } |
| 39 | &.danger { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 40 | fill: theme-color('danger'); |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 41 | } |
| 42 | &.secondary { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 43 | fill: gray('600'); |
Derick Montague | 7f970a1 | 2020-03-02 17:56:09 -0600 | [diff] [blame] | 44 | |
| 45 | svg { |
| 46 | transform: rotate(-45deg); |
| 47 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 48 | } |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 49 | &.warning { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 50 | fill: theme-color('warning'); |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 51 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 52 | } |
| 53 | </style> |