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> |
Derick Montague | 4086572 | 2020-04-13 17:01:19 -0500 | [diff] [blame] | 34 | @import 'src/assets/styles/helpers'; |
| 35 | |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 36 | .status-icon { |
| 37 | vertical-align: text-bottom; |
| 38 | &.success { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 39 | fill: theme-color('success'); |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 40 | } |
| 41 | &.danger { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 42 | fill: theme-color('danger'); |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 43 | } |
| 44 | &.secondary { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 45 | fill: gray('600'); |
Derick Montague | 7f970a1 | 2020-03-02 17:56:09 -0600 | [diff] [blame] | 46 | |
| 47 | svg { |
| 48 | transform: rotate(-45deg); |
| 49 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 50 | } |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 51 | &.warning { |
Derick Montague | fd22b5b | 2020-03-13 15:15:43 -0500 | [diff] [blame] | 52 | fill: theme-color('warning'); |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 53 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 54 | } |
| 55 | </style> |