Skip to content

Commit 33c6a8d

Browse files
authored
feat: always show close button on the active panel in a stack (#1773)
Based on user feedback, we've made close buttons a little more prominent. Mainly the active tab in a stack now always shows it's close button. This mirrors behaviour in other IDEs like vs code. The intent is this will make it slightly less likely to accidently close tabs. Summary: ![close_button_change](https://github.com/deephaven/web-client-ui/assets/1576283/1843df70-38c1-4772-a530-a5c61238efd7) Changes: - show close button on active panels - removed transition so close button appears instantly on hover of non-active panel - added hover background to close button to make it stand-out slightly more - adjusted overall tab size and spacing to be a little tighter - reduced minimum tab size slightly to 10ch to fit more tabs in tab bar
1 parent e6955c1 commit 33c6a8d

30 files changed

Lines changed: 62 additions & 30 deletions

File tree

packages/dashboard/src/layout/GoldenLayout.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
.lm_tab .editor-unsaved-indicator {
88
display: none;
9-
margin-right: 5px;
109
width: 8px;
1110
height: 8px;
11+
margin-right: $spacer-1;
1212
border-radius: 50%;
1313
background: $primary;
1414

packages/golden-layout/scss/goldenlayout-base.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* stylelint-disable no-descending-specificity */
12
// Width variables (appears count calculates by raw css)
23
$width0: 100%; // Appears 3 times
34
$width1: 20px; // Appears 2 times
@@ -140,7 +141,7 @@ $height6: 15px; // Appears 1 time
140141
cursor: pointer;
141142
height: $height2;
142143
margin-top: 1px;
143-
padding: 0px 10px 5px;
144+
padding: 0 10px 5px;
144145
padding-right: 25px;
145146
position: relative;
146147
min-width: 0;
@@ -185,7 +186,7 @@ $height6: 15px; // Appears 1 time
185186
.lm_tabs {
186187
transform-origin: left top;
187188
top: 0;
188-
width: 1000px; /*hack*/
189+
width: 1000px; /* hack */
189190
}
190191
.lm_controls {
191192
bottom: 0;

packages/golden-layout/scss/goldenlayout-dark-theme.scss

Lines changed: 58 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
/* stylelint-disable no-descending-specificity */
12
@import '@deephaven/components/scss/custom.scss';
23

34
$tab-height: 28px;
5+
$tab-padding-x: 6px;
46
$drag-border-width: 5px;
57

6-
$close-button-height: 8px;
78
$tab-font-size: 12px;
89

910
$lm-tab-color: $gray-400;
@@ -19,15 +20,6 @@ $lm-header-background: var(--dh-color-golden-layout-tab-header-bg);
1920
$lm-splitter-hover-color: $gray-400;
2021
$lm-splitter-active-color: $gray-300;
2122

22-
@mixin hover-opacity {
23-
opacity: 0.4;
24-
transition: opacity 300ms ease;
25-
26-
&:hover {
27-
opacity: 1;
28-
}
29-
}
30-
3123
// ".lm_dragging" is applied to BODY tag during Drag and is also directly applied to the root of the object being dragged
3224
//is added to the body class, prevents overflow in our app context
3325
.lm_dragging {
@@ -56,7 +48,15 @@ body:not(.lm_dragging) .lm_header .lm_tab:not(.lm_active):hover {
5648
}
5749

5850
body:not(.lm_dragging) .lm_header .lm_tab:hover .lm_close_tab {
59-
@include hover-opacity;
51+
opacity: 0.35;
52+
53+
&:hover {
54+
opacity: 1;
55+
56+
&::before {
57+
opacity: 1;
58+
}
59+
}
6060
}
6161

6262
// Entire GoldenLayout Container, if a background is set, it is visible as color of "pane header" and "splitters" (if these latest has opacity very low)
@@ -155,20 +155,20 @@ body:not(.lm_dragging) .lm_header .lm_tab:hover .lm_close_tab {
155155
color: $lm-tab-color;
156156
height: $tab-height;
157157
font-size: $tab-font-size;
158-
min-width: 5rem;
158+
min-width: 10ch;
159159
margin: 0;
160-
padding: 0 $spacer-1 0 $spacer-2;
160+
padding: 0 0 0 $tab-padding-x;
161161
box-shadow: inset -1px -1px 0 0 $background; // acting as bottom and right border
162162
transition:
163163
color $transition,
164164
background-color $transition;
165-
max-width: 12rem;
165+
max-width: 12.25rem;
166166
white-space: nowrap;
167167
overflow: hidden;
168168

169169
.lm_title {
170170
flex-grow: 1;
171-
padding-right: $spacer-1;
171+
padding-right: $tab-padding-x;
172172
// add equalized spacing for tabs without close buttons
173173
// so that when a tab is longer then min-width it still
174174
// is balanced with equal padding. Extra padding is then
@@ -182,21 +182,42 @@ body:not(.lm_dragging) .lm_header .lm_tab:hover .lm_close_tab {
182182

183183
// Close Tab Icon
184184
.lm_close_tab {
185-
$lm-close-button-padding: 4px;
186-
187-
@include icon-image-mask(
188-
var(--dh-svg-icon-close-tab),
189-
$close-button-height
190-
);
185+
$close-button-size: 8px;
191186

187+
margin-left: -$tab-padding-x;
188+
flex-shrink: 0;
192189
cursor: pointer;
193190
position: relative;
194-
width: $close-button-height;
195-
height: $close-button-height;
196-
padding: $lm-close-button-padding;
197-
margin-left: -$spacer-1; // undo padding on title
191+
width: 18px;
192+
height: 100%;
198193
opacity: 0;
199-
transition: opacity 300ms ease;
194+
// intentionally no transition on close icon
195+
// we want the button to appear instantly
196+
197+
&::before {
198+
// used for hover background
199+
// which is a different shape then the hit area
200+
content: '';
201+
position: absolute;
202+
inset: 3px 3px 3px 1px; // looks better offset
203+
border-radius: 2px;
204+
background-color: var(--dh-color-highlight-selected-hover);
205+
opacity: 0;
206+
transition: opacity $transition ease;
207+
}
208+
209+
&::after {
210+
// since this is a mask, we need to isolate it
211+
// so it doesn't mask our hover background
212+
@include icon-image-mask(
213+
var(--dh-svg-icon-close-tab),
214+
$close-button-size
215+
);
216+
217+
content: '';
218+
position: absolute;
219+
inset: 0 2px 0 0; // looks better offset
220+
}
200221
}
201222
}
202223
}
@@ -221,6 +242,11 @@ body:not(.lm_dragging) .lm_header .lm_tab:hover .lm_close_tab {
221242
inset 0 1px $primary,
222243
inset -1px 0 0 0 $background; // top focus indicator, right border
223244
}
245+
246+
.lm_close_tab {
247+
// show close button on active tab
248+
opacity: 0.35;
249+
}
224250
}
225251

226252
.lm_window_blur {
@@ -233,7 +259,12 @@ body:not(.lm_dragging) .lm_header .lm_tab:hover .lm_close_tab {
233259
.lm_controls {
234260
// All Pane controls shares these
235261
> li {
236-
@include hover-opacity;
262+
opacity: 0.4;
263+
transition: opacity $transition ease;
264+
265+
&:hover {
266+
opacity: 1;
267+
}
237268

238269
position: relative;
239270
background-position: center center;
770 Bytes
Loading
280 Bytes
Loading
287 Bytes
Loading
121 Bytes
Loading
152 Bytes
Loading
51 Bytes
Loading
695 Bytes
Loading

0 commit comments

Comments
 (0)