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'" /> |
| 4 | <icon-danger v-else-if="status === 'danger'" /> |
| 5 | <icon-secondary v-else /> |
| 6 | </span> |
| 7 | </template> |
| 8 | |
| 9 | <script> |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 10 | import IconCheckmark from '@carbon/icons-vue/es/checkmark--filled/20'; |
| 11 | import IconWarning from '@carbon/icons-vue/es/warning--filled/20'; |
| 12 | import IconError from '@carbon/icons-vue/es/error--filled/20'; |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 13 | |
| 14 | export default { |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 15 | name: 'StatusIcon', |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 16 | components: { |
| 17 | iconSuccess: IconCheckmark, |
| 18 | iconDanger: IconWarning, |
| 19 | iconSecondary: IconError |
Derick Montague | 5e7ac49 | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 20 | }, |
| 21 | props: { |
| 22 | status: { |
| 23 | type: String, |
| 24 | default: '' |
| 25 | } |
Yoshie Muranaka | dc04feb | 2019-12-04 08:41:22 -0800 | [diff] [blame] | 26 | } |
| 27 | }; |
| 28 | </script> |
| 29 | |
| 30 | <style lang="scss" scoped> |
| 31 | .status-icon { |
| 32 | vertical-align: text-bottom; |
| 33 | &.success { |
| 34 | fill: $success; |
| 35 | } |
| 36 | &.danger { |
| 37 | fill: $danger; |
| 38 | } |
| 39 | &.secondary { |
| 40 | fill: $secondary; |
| 41 | } |
| 42 | } |
| 43 | </style> |