blob: 4b2b47ddef276ce28b3178812a1da38b91f25eb5 [file] [log] [blame]
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08001<template>
2 <span :class="['status-icon', status]">
SurenNeware57b22622020-08-07 18:22:47 +05303 <icon-info v-if="status === 'info'" />
4 <icon-success v-else-if="status === 'success'" />
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -08005 <icon-warning v-else-if="status === 'warning'" />
Yoshie Muranakadc04feb2019-12-04 08:41:22 -08006 <icon-danger v-else-if="status === 'danger'" />
7 <icon-secondary v-else />
8 </span>
9</template>
10
11<script>
SurenNeware57b22622020-08-07 18:22:47 +053012import IconInfo from '@carbon/icons-vue/es/information--filled/20';
Derick Montaguee2fd1562019-12-20 13:26:53 -060013import IconCheckmark from '@carbon/icons-vue/es/checkmark--filled/20';
14import IconWarning from '@carbon/icons-vue/es/warning--filled/20';
15import IconError from '@carbon/icons-vue/es/error--filled/20';
Sukanya Pandeyb2ca0c02020-07-20 23:23:29 +053016import IconMisuse from '@carbon/icons-vue/es/misuse/20';
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080017
18export default {
Derick Montaguee2fd1562019-12-20 13:26:53 -060019 name: 'StatusIcon',
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080020 components: {
SurenNeware57b22622020-08-07 18:22:47 +053021 IconInfo: IconInfo,
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080022 iconSuccess: IconCheckmark,
Sukanya Pandeyb2ca0c02020-07-20 23:23:29 +053023 iconDanger: IconMisuse,
24 iconSecondary: IconError,
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080025 iconWarning: IconWarning
Derick Montague09e45cd2020-01-23 15:45:57 -060026 },
27 props: {
28 status: {
29 type: String,
30 default: ''
31 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080032 }
33};
34</script>
35
36<style lang="scss" scoped>
37.status-icon {
38 vertical-align: text-bottom;
Derick Montague579cbdf2020-07-14 21:20:29 -050039
SurenNeware57b22622020-08-07 18:22:47 +053040 &.info {
Derick Montague579cbdf2020-07-14 21:20:29 -050041 color: theme-color('info');
SurenNeware57b22622020-08-07 18:22:47 +053042 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080043 &.success {
Derick Montague579cbdf2020-07-14 21:20:29 -050044 color: theme-color('success');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080045 }
46 &.danger {
Derick Montague579cbdf2020-07-14 21:20:29 -050047 color: theme-color('danger');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080048 }
49 &.secondary {
Derick Montague579cbdf2020-07-14 21:20:29 -050050 color: gray('600');
51 transform: rotate(-45deg);
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080052 }
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080053 &.warning {
Derick Montague579cbdf2020-07-14 21:20:29 -050054 color: theme-color('warning');
55 }
56
57 svg {
58 fill: currentColor;
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080059 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080060}
61</style>