Skip to content

Commit 487e54f

Browse files
authored
chore: active tabs the same colour as the active workspace COMPASS-7958 (#5934)
* active tabs the same colour as the active workspace * keep the single connection colours for now * the close button is always visible * match the selected colour used in the sidebar * also match the dark mode colour * the close button is always visible * update expected colours
1 parent 0acfcb0 commit 487e54f

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

packages/compass-components/src/components/workspace-tabs/tab.spec.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ describe('Tab', function () {
4444
.visible;
4545
});
4646

47-
it('should render the close tab button visible', async function () {
48-
expect(await screen.findByLabelText('Close Tab')).to.be.visible;
49-
});
50-
5147
it('should call "onClose" when the close button is clicked', async function () {
5248
expect(onCloseSpy.callCount).to.equal(0);
5349
const closeTabButton = await screen.findByLabelText('Close Tab');
@@ -78,10 +74,6 @@ describe('Tab', function () {
7874
);
7975
});
8076

81-
it('should render the close tab button hidden', async function () {
82-
expect(await screen.findByLabelText('Close Tab')).to.not.be.visible;
83-
});
84-
8577
// Focus visible is not working proper in jsdom environment
8678
it.skip('should render the close tab button visible when the tab is focused', async function () {
8779
const tabToFocus = await screen.findByRole('tab');

packages/compass-components/src/components/workspace-tabs/tab.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,21 @@ const tabStyles = css({
2424
paddingRight: spacing[1],
2525
gap: spacing[2],
2626

27+
// same as the border at the top
28+
paddingBottom: '4px',
29+
2730
maxWidth: spacing[6] * 4,
2831
minWidth: spacing[6] * 2,
2932
height: 36,
3033
position: 'relative',
3134
outline: 'none',
3235

36+
// hide the close button until it animates in
37+
overflow: 'hidden',
38+
39+
// leave space so the active and other tabs line up
40+
borderTop: '4px solid transparent',
41+
3342
backgroundColor: 'var(--workspace-tab-background-color)',
3443
color: 'var(--workspace-tab-color)',
3544
boxShadow: 'inset -1px -1px 0 0 var(--workspace-tab-border-color)',
@@ -78,6 +87,7 @@ const tabLightThemeStyles = css({
7887
'--workspace-tab-border-color': palette.gray.light2,
7988
'--workspace-tab-color': palette.gray.base,
8089
'--workspace-tab-selected-color': palette.green.dark2,
90+
'--workspace-tab-selected-border-color': 'transparent',
8191
'&:focus-visible': {
8292
'--workspace-tab-selected-color': palette.blue.base,
8393
'--workspace-tab-border-color': palette.blue.base,
@@ -90,6 +100,7 @@ const tabDarkThemeStyles = css({
90100
'--workspace-tab-border-color': palette.gray.dark2,
91101
'--workspace-tab-color': palette.gray.base,
92102
'--workspace-tab-selected-color': palette.green.base,
103+
'--workspace-tab-selected-border-color': 'transparent',
93104
'&:focus-visible': {
94105
'--workspace-tab-selected-color': palette.blue.light1,
95106
'--workspace-tab-border-color': palette.blue.light1,
@@ -99,6 +110,7 @@ const tabDarkThemeStyles = css({
99110
const selectedTabStyles = css({
100111
color: 'var(--workspace-tab-selected-color)',
101112
backgroundColor: 'var(--workspace-tab-selected-background-color)',
113+
borderTopColor: 'var(--workspace-tab-selected-border-color)',
102114
boxShadow: 'inset -1px 0 0 0 var(--workspace-tab-border-color)',
103115

104116
'&:hover': {
@@ -158,11 +170,15 @@ const tabSubtitleStyles = css({
158170
});
159171

160172
const closeButtonStyles = css({
161-
visibility: 'hidden',
173+
transition: tabTransition,
174+
transitionProperty: 'opacity, transform',
175+
transform: 'translateY(44px)',
176+
opacity: 0,
162177
});
163178

164179
const selectedCloseButtonStyles = css({
165-
visibility: 'visible',
180+
transform: 'translateY(0)',
181+
opacity: 1,
166182
});
167183

168184
type IconGlyph = Extract<keyof typeof glyphs, string>;

packages/compass-connections/src/hooks/use-tab-connection-theme.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ describe('useTabConnectionTheme', function () {
9999
'--workspace-tab-background-color': '#FFDFB5',
100100
'--workspace-tab-border-color': '#E8EDEB',
101101
'--workspace-tab-color': '#5C6C75',
102-
'--workspace-tab-selected-background-color': '#FFD19A',
103-
'--workspace-tab-selected-color': '#3D4F58',
102+
'--workspace-tab-selected-background-color': '#FFFFFF',
103+
'--workspace-tab-selected-border-color': '#FFD19A',
104+
'--workspace-tab-selected-color': '#1C2D38',
104105
});
105106
});
106107
});

packages/compass-connections/src/hooks/use-tab-connection-theme.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ export function useTabConnectionTheme(): ThemeProvider {
4646
'--workspace-tab-color': darkTheme
4747
? palette.gray.base
4848
: palette.gray.dark1,
49-
'--workspace-tab-selected-background-color': activeBgColor,
49+
'--workspace-tab-selected-background-color': darkTheme
50+
? palette.black
51+
: palette.white,
52+
'--workspace-tab-selected-border-color': activeBgColor,
5053
'--workspace-tab-selected-color': darkTheme
51-
? palette.gray.light2
52-
: palette.gray.dark2,
54+
? palette.white
55+
: palette.gray.dark3,
5356
'&:focus-visible': {
5457
'--workspace-tab-border-color': darkTheme
5558
? palette.blue.light1

0 commit comments

Comments
 (0)