blob: bf58722aa912781ea6979f9750193afc4e31505f [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;
SurenNeware57b22622020-08-07 18:22:47 +053039 &.info {
40 fill: theme-color('info');
41 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080042 &.success {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050043 fill: theme-color('success');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080044 }
45 &.danger {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050046 fill: theme-color('danger');
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080047 }
48 &.secondary {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050049 fill: gray('600');
Derick Montague7f970a12020-03-02 17:56:09 -060050
51 svg {
52 transform: rotate(-45deg);
53 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080054 }
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080055 &.warning {
Derick Montaguefd22b5b2020-03-13 15:15:43 -050056 fill: theme-color('warning');
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080057 }
Yoshie Muranakadc04feb2019-12-04 08:41:22 -080058}
59</style>