Skip to content

Commit 680cf52

Browse files
LITE-26563 add status component (#29)
1 parent 062a3b4 commit 680cf52

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import card from './widgets/card/widget.vue';
88
import icon from './widgets/icon/widget.vue';
99
import view from './widgets/view/widget.vue';
1010
import navigation from './widgets/navigation/widget.vue';
11+
import status from './widgets/status/widget.vue';
1112

1213
import _store from './core/store';
1314
import _bus from './core/eventBus';
@@ -19,6 +20,7 @@ export const Card = card;
1920
export const Icon = icon;
2021
export const View = view;
2122
export const Navigation = navigation;
23+
export const Status = status;
2224

2325
export const bus = _bus;
2426
export const store = _store;

src/stories/Status.stories.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import Status from '~widgets/status/widget.vue';
2+
import registerWidget from '~core/registerWidget';
3+
4+
import * as icons from '@cloudblueconnect/material-svg';
5+
6+
registerWidget('ui-status', Status);
7+
8+
export default {
9+
title: 'Components/Status',
10+
component: Status,
11+
parameters: {
12+
layout: 'centered',
13+
},
14+
argTypes: {
15+
iconName: {
16+
options: Object.keys(icons),
17+
control: {
18+
type: 'select',
19+
},
20+
}
21+
}
22+
};
23+
24+
export const Component = {
25+
render: (args) => ({
26+
components: { Status },
27+
setup() {
28+
return { args };
29+
},
30+
template: '<ui-status style="font-size: 20px" v-bind="args"></ui-status>',
31+
}),
32+
33+
args: {
34+
text: 'Status text',
35+
iconName: 'googleUpdateBaseline',
36+
iconColor: 'green',
37+
iconSize: '20',
38+
}
39+
};

src/widgets/status/widget.vue

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<template>
2+
<div class="status-mark">
3+
<ui-icon
4+
class="status-mark__icon"
5+
:icon-name="iconName"
6+
:color="iconColor"
7+
:size="iconSize"
8+
/>
9+
<span
10+
class="status-mark__text"
11+
> {{ text }}
12+
</span>
13+
</div>
14+
</template>
15+
16+
17+
<script>
18+
import icon from '~widgets/icon/widget.vue';
19+
import registerWidget from '~core/registerWidget';
20+
registerWidget('ui-icon', icon);
21+
22+
export default {
23+
props: {
24+
text: {
25+
type: String,
26+
default: '',
27+
},
28+
29+
iconName: {
30+
type: String,
31+
default: '',
32+
},
33+
34+
iconColor: {
35+
type: String,
36+
default: '#212121',
37+
},
38+
39+
iconSize: {
40+
type: [Number, String],
41+
default: '16',
42+
}
43+
},
44+
};
45+
</script>
46+
47+
48+
<style lang="stylus">
49+
.status-mark {
50+
display: inline-flex;
51+
align-items: center;
52+
vertical-align: middle;
53+
font-size: 14px;
54+
line-height: 20px;
55+
56+
&__icon {
57+
margin-right: 4px;
58+
flex: 0 0 auto;
59+
}
60+
61+
&__text {
62+
font-size: inherit;
63+
line-height: inherit;
64+
white-space: nowrap;
65+
}
66+
}
67+
</style>

0 commit comments

Comments
 (0)