Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/components/Tab/STabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class STabs extends Mixins(BorderRadiusMixin) {
*
* `"rounded"` works only when position is `"top"` or `"bottom"`
*/
@Prop({ type: String, default: '' }) readonly type!: string
@Prop({ type: String, default: '' }) readonly type!: TabsType
/**
* Will tabs be closable.
*
Expand Down Expand Up @@ -88,10 +88,9 @@ export default class STabs extends Mixins(BorderRadiusMixin) {
}

get computedType (): string {
if (!(Object.values(TabsType) as Array<string>).includes(this.type)) {
return ''
}
return this.type !== TabsType.ROUNDED ? this.type : ''
if (!(Object.values(TabsType) as Array<string>).includes(this.type)) return ''
if ([TabsType.ROUNDED, TabsType.ACCENT_ROUNDED].includes(this.type)) return ''
return this.type
}

get computedClasses (): Array<string> {
Expand All @@ -100,6 +99,10 @@ export default class STabs extends Mixins(BorderRadiusMixin) {
([TabsPosition.TOP, TabsPosition.BOTTOM] as Array<string>).includes(this.position)) {
cssClasses.push('s-rounded')
}
if (this.type === TabsType.ACCENT_ROUNDED &&
([TabsPosition.TOP, TabsPosition.BOTTOM] as Array<string>).includes(this.position)) {
cssClasses.push('s-accent-rounded')
}
if (this.isStandardBorderRadius) {
cssClasses.push(`s-border-radius-${this.borderRadius}`)
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Tab/consts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum TabsType {
ROUNDED = 'rounded',
ACCENT_ROUNDED = 'accent-rounded',
CARD = 'card',
BORDER_CARD = 'border-card'
}
Expand Down
46 changes: 46 additions & 0 deletions src/styles/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
}
}
}
&.s-accent-rounded {
.el-tabs__nav-wrap {
border-radius: $border-radius;
.el-tabs__item {
border-radius: $border-radius;
}
}
}
}
}
}
Expand Down Expand Up @@ -91,6 +99,9 @@
.el-tabs__nav-wrap {
background-color: var(--s-color-base-background);
height: 32px;
.el-tabs__nav {
display: flex;
}
.el-tabs__nav-scroll {
padding: 2px;
}
Expand Down Expand Up @@ -118,6 +129,41 @@
}
}
}
&.s-accent-rounded {
$height: 32px;
.el-tabs__header {
height: $height;
width: fit-content;
margin-bottom: 20px;
}
.el-tabs__nav-wrap {
background-color: var(--s-color-base-background);
height: $height;
.el-tabs__nav {
display: flex;
}
&::after,
.el-tabs__active-bar {
height: 0;
}
.el-tabs__item {
padding: 0 18px;
height: $height;
line-height: $height;
transition: 200ms;
&.is-active {
color: var(--s-color-base-on-accent);
background-color: var(--s-color-theme-accent);
i {
color: var(--s-color-base-on-accent);
}
}
i {
line-height: $height;
}
}
}
}
.el-tabs__active-bar {
background-color: var(--s-color-theme-accent);
}
Expand Down