blob: 1114321227f1e01eb56bd45ba5d6fd366315eb52 [file] [log] [blame]
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08001<template>
2 <span :class="['status-icon', status]">
3 <icon-success v-if="status === 'success'" />
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -08004 <icon-warning v-else-if="status === 'warning'" />
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08005 <icon-danger v-else-if="status === 'danger'" />
6 <icon-secondary v-else />
7 </span>
8</template>
9
10<script>
Derick Montaguee2fd1562019-12-20 13:26:53 -060011import IconCheckmark from '@carbon/icons-vue/es/checkmark--filled/20';
12import IconWarning from '@carbon/icons-vue/es/warning--filled/20';
13import IconError from '@carbon/icons-vue/es/error--filled/20';
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080014
15export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060016 name: 'StatusIcon',
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080017 components: {
18 iconSuccess: IconCheckmark,
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080019 iconDanger: IconError,
20 iconSecondary: IconError, //TODO: swap with right asset when available
21 iconWarning: IconWarning
Derick Montague09e45cd2020-01-23 15:45:57 -060022 },
23 props: {
24 status: {
25 type: String,
26 default: ''
27 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080028 }
29};
30</script>
31
32<style lang="scss" scoped>
33.status-icon {
34 vertical-align: text-bottom;
35 &.success {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050036 fill: theme-color('success');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080037 }
38 &.danger {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050039 fill: theme-color('danger');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080040 }
41 &.secondary {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050042 fill: gray('600');
Derick Montague7f970a12020-03-02 17:56:09 -060043
44 svg {
45 transform: rotate(-45deg);
46 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080047 }
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080048 &.warning {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050049 fill: theme-color('warning');
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080050 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080051}
52</style>