blob: 560880504c7b5f5a021fbb3a61b4bd4c2ac31d77 [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';
Sukanya Pandeyb2ca0c02020-07-20 23:23:29 +053014import IconMisuse from '@carbon/icons-vue/es/misuse/20';
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080015
16export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060017 name: 'StatusIcon',
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080018 components: {
19 iconSuccess: IconCheckmark,
Sukanya Pandeyb2ca0c02020-07-20 23:23:29 +053020 iconDanger: IconMisuse,
21 iconSecondary: IconError,
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080022 iconWarning: IconWarning
Derick Montague09e45cd2020-01-23 15:45:57 -060023 },
24 props: {
25 status: {
26 type: String,
27 default: ''
28 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080029 }
30};
31</script>
32
33<style lang="scss" scoped>
Derick Montague40865722020-04-13 17:01:19 -050034@import 'src/assets/styles/helpers';
35
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080036.status-icon {
37 vertical-align: text-bottom;
38 &.success {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050039 fill: theme-color('success');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080040 }
41 &.danger {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050042 fill: theme-color('danger');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080043 }
44 &.secondary {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050045 fill: gray('600');
Derick Montague7f970a12020-03-02 17:56:09 -060046
47 svg {
48 transform: rotate(-45deg);
49 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080050 }
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080051 &.warning {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050052 fill: theme-color('warning');
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080053 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080054}
55</style>