Skip to content

Commit 3201f89

Browse files
committed
fixed tabs styling
1 parent 0a4bc9e commit 3201f89

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

src/components/ContentTabCard/src/ContentTabCard.vue

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div>
3-
<el-row :class="[tabStyle, 'tabs-container p-16']">
2+
<div class="container">
3+
<el-row :class="[tabStyle, 'tabs-container']">
44
<el-col class="tabs-column">
55
<span :class="[tabStyle, 'link-container']" v-for="tab in tabs" :key="tab.label">
66
<!-- Expect this to be either nuxt-link or router-link -->
@@ -29,7 +29,7 @@
2929
</span>
3030
</el-col>
3131
</el-row>
32-
<div class="content px-16 pb-16">
32+
<div class="content">
3333
<slot />
3434
</div>
3535
</div>
@@ -84,65 +84,57 @@ export default {
8484

8585
<style lang="scss" scoped>
8686
@import '../../../assets/_variables.scss';
87+
.container {
88+
width: fit-content;
89+
min-width: 100%;
90+
display: table;
91+
}
92+
8793
.tab-link {
8894
text-decoration: none;
8995
flex-wrap: nowrap;
9096
cursor: pointer;
9197
&.style1, &.style3 {
92-
border-bottom: 2px solid $lineColor1;
98+
border-bottom: .125em solid $lineColor1;
9399
}
94100
&.style1, &.style2 {
95101
margin-right: 2rem;
102+
padding-bottom: .12em;
96103
}
97104
&.style3 {
98105
margin-right: .5rem;
106+
padding-bottom: .2em;
99107
}
100108
&:hover, &.active {
101109
&.style1, &.style3 {
102-
border-bottom: 2px solid $purple;
110+
border-bottom: .125em solid $purple;
103111
color: $purple;
104112
font-weight: 500;
105113
}
106114
&.style2 {
107-
border-bottom: 2px solid white;
115+
border-bottom: .125em solid white;
108116
font-weight: 500;
109117
}
110118
}
111119
}
112-
.link-container {
113-
position: relative;
114-
}
115120
.tabs-column {
116121
.link-container:last-child > .tab-link {
117122
margin-right: 0;
118123
}
119124
}
120-
.link-container.style1:not(:first-child):after {
121-
content: '';
122-
width: 2rem;
123-
display: inline-block;
124-
border-bottom: 2px solid $lineColor1;
125-
position: absolute;
126-
left: -2rem;
127-
top: 1.2rem;
128-
}
129-
.link-container.style3:not(:first-child):after {
130-
content: '';
131-
width: .5rem;
132-
display: inline-block;
133-
border-bottom: 2px solid $lineColor1;
134-
position: absolute;
135-
left: -.5rem;
136-
top: 1.125rem;
137-
}
138125
.tabs-container {
139126
white-space: nowrap;
140-
width: fit-content;
127+
display: block;
128+
&.style1, &.style3 {
129+
border-bottom: .125em solid $lineColor1;
130+
}
141131
&.style2 {
142132
background-color: $darkBlue;
133+
padding: 1.5rem;
143134
}
144135
}
145136
.content {
146-
white-space: nowrap;
137+
display: table-caption;
138+
caption-side: bottom;
147139
}
148140
</style>

src/stories/contentTabCard/contentTabCard.stories.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const createDemo = (contentTabCardItem) => {
2828
<div
2929
v-for="tab in tabs"
3030
:key="tab.id"
31+
class="m-8"
3132
>
3233
<div
3334
v-show="activeTabId === tab.id"
@@ -50,6 +51,10 @@ export const Primary = () => createDemo(
5051
label: 'Diseases',
5152
id: 'Diseases'
5253
},
54+
{
55+
label: 'Organs',
56+
id: 'Organs'
57+
},
5358
{
5459
label: 'Datasets',
5560
id: 'Datasets',

src/stories/contentTabCard/contentTabCard.stories.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ data() {
4343
label: 'Diseases',
4444
id: 'Diseases'
4545
},
46+
{
47+
label: 'Organs',
48+
id: 'Organs'
49+
},
4650
{
4751
label: 'Datasets',
4852
id: 'Datasets'
@@ -67,6 +71,7 @@ methods: {
6771
<div
6872
v-for="tab in tabs"
6973
:key="tab.id"
74+
class="m-8"
7075
>
7176
<div
7277
v-show="activeTabId === tab.id"

0 commit comments

Comments
 (0)