Skip to content

Commit d70e541

Browse files
committed
chore(ui:tabs): adjust style
1 parent 912d557 commit d70e541

5 files changed

Lines changed: 20 additions & 5 deletions

File tree

packages/ui/src/components/tabs/Tabs.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ export function DTabs<ID extends DId, T extends DTabsOption<ID>>(props: DTabsPro
146146
useEffect(() => {
147147
const [asyncGroup, asyncId] = asyncCapture.createGroup();
148148

149+
if (tablistWrapperRef.current) {
150+
asyncGroup.onResize(tablistWrapperRef.current, () => {
151+
refreshTabs();
152+
});
153+
}
154+
149155
if (tablistRef.current) {
150156
asyncGroup.onResize(tablistRef.current, () => {
151157
refreshTabs();

packages/ui/src/styles/_variables.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ $colors: (
6666
--#{$variable-prefix}background-color-input: #fff;
6767
--#{$variable-prefix}background-color-indicator: #dfe1e6;
6868
--#{$variable-prefix}background-color-disabled: #f5f5f5;
69+
--#{$variable-prefix}background-color-gray: hsl(0deg 0% 98%);
6970
--#{$variable-prefix}color-divider: #eee;
7071
--#{$variable-prefix}color-border: #d9d9d9;
7172
--#{$variable-prefix}color-disabled: #d5d5d5;
@@ -96,5 +97,5 @@ $colors: (
9697
--#{$variable-prefix}empty-color: #a8afbc;
9798
--#{$variable-prefix}switch-background-color: #d4d6d9;
9899
--#{$variable-prefix}tag-background-color: rgb(0 0 0 / 6%);
99-
--#{$variable-prefix}compose-item-gray-background-color: hsl(0deg 0% 98%);
100+
--#{$variable-prefix}tabs-slider-background-color: hsl(0deg 0% 97%);
100101
}

packages/ui/src/styles/components/compose.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
@include utils-disabled(true);
9797

9898
@include m(gray) {
99-
background-color: var(--#{$variable-prefix}compose-item-gray-background-color);
99+
background-color: var(--#{$variable-prefix}background-color-gray);
100100
}
101101

102102
@include m(smaller) {

packages/ui/src/styles/components/tabs.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
$selector: &;
231231

232232
--#{$variable-prefix}tabs-tab-size: 44px;
233+
--#{$variable-prefix}tabs-slider-tab-size: 36px;
233234
--#{$variable-prefix}tabs-tab-gap: 0 32px;
234235
--#{$variable-prefix}tabs-tab-padding: 16px;
235236

@@ -260,6 +261,7 @@
260261

261262
@include m(larger) {
262263
--#{$variable-prefix}tabs-tab-size: 52px;
264+
--#{$variable-prefix}tabs-slider-tab-size: 44px;
263265
--#{$variable-prefix}tabs-tab-gap: 36px;
264266
--#{$variable-prefix}tabs-tab-padding: 20px;
265267

@@ -270,6 +272,7 @@
270272

271273
@include m(smaller) {
272274
--#{$variable-prefix}tabs-tab-size: 36px;
275+
--#{$variable-prefix}tabs-slider-tab-size: 32px;
273276
--#{$variable-prefix}tabs-tab-gap: 20px;
274277
--#{$variable-prefix}tabs-tab-padding: 12px;
275278

@@ -279,6 +282,8 @@
279282
}
280283

281284
@include m(slider) {
285+
--#{$variable-prefix}tabs-tab-size: var(--#{$variable-prefix}tabs-slider-tab-size);
286+
282287
&#{$selector}--top,
283288
&#{$selector}--bottom {
284289
.#{$variable-prefix}tab {
@@ -288,11 +293,13 @@
288293

289294
@include e(tablist-wrapper) {
290295
padding: 0;
291-
background-color: var(--#{$variable-prefix}background-color-primary);
296+
border-radius: var(--#{$variable-prefix}border-radius);
292297
}
293298

294299
@include e(tablist) {
295300
gap: 0;
301+
min-width: unset;
302+
background-color: var(--#{$variable-prefix}tabs-slider-background-color);
296303

297304
&::after {
298305
content: none;
@@ -386,7 +393,7 @@
386393
position: absolute;
387394
z-index: 1;
388395
pointer-events: none;
389-
background-color: var(--#{$variable-prefix}background-color-primary);
396+
background-color: var(--#{$variable-prefix}background-color-gray);
390397
border: 1px solid var(--#{$variable-prefix}background-color-indicator);
391398
opacity: 0;
392399
}

packages/ui/src/styles/theme-dark.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ body.dark {
2727
--#{$variable-prefix}background-color-input: #121212;
2828
--#{$variable-prefix}background-color-indicator: #3d3e40;
2929
--#{$variable-prefix}background-color-disabled: #2c2c2c;
30+
--#{$variable-prefix}background-color-gray: hsl(0deg 0% 0%);
3031
--#{$variable-prefix}color-divider: #303030;
3132
--#{$variable-prefix}color-border: #434343;
3233
--#{$variable-prefix}color-disabled: #4e4e50;
@@ -57,5 +58,5 @@ body.dark {
5758
--#{$variable-prefix}empty-color: #868a93;
5859
--#{$variable-prefix}switch-background-color: #5f6164;
5960
--#{$variable-prefix}tag-background-color: rgb(255 255 255 / 10%);
60-
--#{$variable-prefix}compose-item-gray-background-color: hsl(0deg 0% 2%);
61+
--#{$variable-prefix}tabs-slider-background-color: hsl(0deg 0% 0%);
6162
}

0 commit comments

Comments
 (0)