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