Skip to content

Commit fb070ac

Browse files
committed
fix: vertical tabs style fix
1 parent 7c532b7 commit fb070ac

File tree

5 files changed

+77
-20
lines changed

5 files changed

+77
-20
lines changed

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@commitlint/config-conventional": "^13.2.0",
4949
"@release-it/conventional-changelog": "^5.1.1",
5050
"@stencil-community/postcss": "^2.2.0",
51-
"@stencil/core": "^4.12.2",
51+
"@stencil/core": "^4.12.3",
5252
"@stencil/react-output-target": "^0.5.3",
5353
"@stencil/sass": "^3.0.4",
5454
"@stencil/vue-output-target": "^0.8.6",

packages/core/src/components/go-tabs/go-tablist.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ export class GoTablist {
127127
this.deactivateTabs();
128128
const tabId = tabEl.getAttribute('id');
129129

130-
this.activeTabRect = tabEl.getBoundingClientRect();
131-
132130
this.tabsState = this.tabsState.map((tab, i) => {
133131
if (tab.tabId === tabId) {
134132
this.activeIndex = i;
@@ -150,6 +148,10 @@ export class GoTablist {
150148
index: this.activeIndex,
151149
tabEl,
152150
});
151+
152+
requestAnimationFrame(() => {
153+
this.activeTabRect = tabEl.getBoundingClientRect();
154+
});
153155
}
154156

155157
// When a tab is clicked, activateTab is fired to activate it
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
go-tabs {
2+
--tab-padding: 0.75rem 1.25rem;
3+
--tab-bg-color: transparent;
4+
--tab-hover-bg-color: var(--go-color-neutral-200);
5+
--tab-text-color: var(--go-color-neutral-700);
6+
--tab-focus-color: var(--go-color-primary-600);
7+
--tab-active-color: var(--go-color-primary-800);
8+
--tab-active-bg-color: transparent;
9+
--tab-border-width: 0.2em;
10+
--tab-active-indicator-color: var(--tab-active-color);
11+
--tabs-active-indicator-width: 0;
12+
--tabs-active-indicator-height: 0.2em;
13+
--tabs-active-indicator-color: var(--tab-active-color);
14+
--tabs-vertical-tablist-max-width: 25%;
15+
--tabs-tablist-gap: 1rem;
16+
17+
&.vertical {
18+
display: grid;
19+
grid-template-columns: minmax(min-content, var(--tabs-vertical-tablist-max-width)) 1fr;
20+
gap: var(--tabs-tablist-gap);
21+
[role='tablist'] {
22+
.tabs-active-indicator-track {
23+
width: auto;
24+
top: 0;
25+
left: auto;
26+
.tabs-active-indicator {
27+
--tabs-active-indicator-width: 4px;
28+
transform: translateY(var(--tabs-active-indicator-top));
29+
}
30+
}
31+
}
32+
[role='tab'] {
33+
text-align: start;
34+
white-space: normal;
35+
&:focus-visible {
36+
border-top-color: transparent;
37+
border-left-color: var(--tab-focus-color);
38+
}
39+
}
40+
}
41+
}

packages/core/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<!-- keep this sandbox empty before pushing changes -->
3131
<div class="container">
32-
<go-tabs fill>
32+
<go-tabs fill vertical>
3333
<go-tab label="Icon tab" icon-position="before">
3434
<go-icon name="home" slot="icon"></go-icon>
3535
<p>

pnpm-lock.yaml

+30-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)