@eturnity/eturnity_reusable_components 8.7.4--EPDM-12729.0 → 8.7.4--EPDM-12729.2
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -7,77 +7,89 @@
|
|
7
7
|
:is-active="activeTab === item.id"
|
8
8
|
@click="onTabClick({ id: item.id })"
|
9
9
|
>
|
10
|
-
{{ item.text }}
|
10
|
+
<div>{{ item.text }}</div>
|
11
|
+
<RCIcon v-if="item.hasError" name="warning" size="14px" />
|
11
12
|
</TabItem>
|
12
13
|
</TabsContainer>
|
13
14
|
</PageContainer>
|
14
15
|
</template>
|
15
16
|
|
16
17
|
<script>
|
17
|
-
// import RCTabsHeader from "@eturnity/eturnity_reusable_components/src/components/tabsHeader"
|
18
|
-
// To use:
|
19
|
-
// <RCTabsHeader
|
20
|
-
// :activeTab="activeTabIndex" // should match the 'id'
|
21
|
-
// :tabsData="[
|
22
|
-
// {
|
23
|
-
// text: 'Tab 1',
|
24
|
-
// id: 0
|
25
|
-
//
|
26
|
-
//
|
27
|
-
//
|
28
|
-
//
|
29
|
-
//
|
30
|
-
//
|
31
|
-
//
|
32
|
-
|
18
|
+
// import RCTabsHeader from "@eturnity/eturnity_reusable_components/src/components/tabsHeader"
|
19
|
+
// To use:
|
20
|
+
// <RCTabsHeader
|
21
|
+
// :activeTab="activeTabIndex" // should match the 'id'
|
22
|
+
// :tabsData="[
|
23
|
+
// {
|
24
|
+
// text: 'Tab 1',
|
25
|
+
// id: 0,
|
26
|
+
// hasError: true // optional
|
27
|
+
// },
|
28
|
+
// {
|
29
|
+
// text: 'Tab 1',
|
30
|
+
// id: 1,
|
31
|
+
// hasError: false // optional
|
32
|
+
// }
|
33
|
+
// ]"
|
34
|
+
// />
|
35
|
+
import styled from 'vue3-styled-components'
|
36
|
+
import RCIcon from '../icon'
|
33
37
|
|
34
|
-
const PageContainer = styled.div``
|
38
|
+
const PageContainer = styled.div``
|
35
39
|
|
36
|
-
const TabsContainer = styled.div`
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
`
|
40
|
+
const TabsContainer = styled.div`
|
41
|
+
display: flex;
|
42
|
+
cursor: pointer;
|
43
|
+
width: 100%;
|
44
|
+
`
|
41
45
|
|
42
|
-
const TabAttrs = { isActive: Boolean }
|
43
|
-
const TabItem = styled('div', TabAttrs)`
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
const TabAttrs = { isActive: Boolean }
|
47
|
+
const TabItem = styled('div', TabAttrs)`
|
48
|
+
display: flex;
|
49
|
+
align-items: center;
|
50
|
+
justify-content: center;
|
51
|
+
gap: 8px;
|
52
|
+
padding: 10px 20px;
|
53
|
+
font-size: 14px;
|
54
|
+
font-weight: 600;
|
55
|
+
background-color: ${(props) =>
|
56
|
+
props.isActive ? props.theme.colors.secondary : props.theme.colors.white};
|
57
|
+
color: ${(props) =>
|
51
58
|
props.isActive
|
52
59
|
? props.theme.colors.brightBlue
|
53
|
-
: props.theme.colors.
|
54
|
-
|
55
|
-
|
60
|
+
: props.theme.colors.black};
|
61
|
+
border-bottom: ${(props) =>
|
62
|
+
props.isActive
|
63
|
+
? '4px solid' + props.theme.colors.brightBlue
|
64
|
+
: '1px solid' + props.theme.colors.grey4};
|
65
|
+
flex-grow: 1;
|
66
|
+
`
|
56
67
|
|
57
|
-
export default {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
+
export default {
|
69
|
+
name: 'RCTabsHeader',
|
70
|
+
components: {
|
71
|
+
PageContainer,
|
72
|
+
TabsContainer,
|
73
|
+
TabItem,
|
74
|
+
RCIcon,
|
75
|
+
},
|
76
|
+
props: {
|
77
|
+
tabsData: {
|
78
|
+
required: true,
|
79
|
+
type: Array,
|
80
|
+
},
|
81
|
+
activeTab: {
|
82
|
+
required: true,
|
83
|
+
type: Number,
|
84
|
+
},
|
85
|
+
},
|
86
|
+
methods: {
|
87
|
+
onTabClick({ id }) {
|
88
|
+
if (id === this.activeTab) {
|
89
|
+
return
|
90
|
+
}
|
91
|
+
this.$emit('on-tab-change', id)
|
92
|
+
},
|
68
93
|
},
|
69
|
-
activeTab: {
|
70
|
-
required: true,
|
71
|
-
type: Number
|
72
|
-
}
|
73
|
-
},
|
74
|
-
methods: {
|
75
|
-
onTabClick({ id }) {
|
76
|
-
if (id === this.activeTab) {
|
77
|
-
return
|
78
|
-
}
|
79
|
-
this.$emit('on-tab-change', id)
|
80
|
-
}
|
81
94
|
}
|
82
|
-
}
|
83
95
|
</script>
|