Skip to content

Commit 82599a9

Browse files
authored
Improve table styles (#2289)
* add tooltips to row actions * take off first cell right border when cell is sticky * increase workspace row height * take off right border on last header children * update column resizer hover background color
1 parent 589126b commit 82599a9

File tree

3 files changed

+46
-21
lines changed

3 files changed

+46
-21
lines changed

webview/src/experiments/components/table/CellRowActions.tsx

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import styles from './styles.module.scss'
66
import { clickAndEnterProps } from '../../../util/props'
77
import { StarFull, StarEmpty } from '../../../shared/components/icons'
88
import { pluralize } from '../../../util/strings'
9+
import Tooltip, {
10+
CELL_TOOLTIP_DELAY
11+
} from '../../../shared/components/tooltip/Tooltip'
912

1013
export type CellRowActionsProps = {
1114
isRowSelected: boolean
@@ -27,6 +30,7 @@ export type CellRowActionProps = {
2730
children: React.ReactElement
2831
hidden?: boolean
2932
testId?: string
33+
tooltipContent: string
3034
}
3135

3236
export const CellRowAction: React.FC<CellRowActionProps> = ({
@@ -35,25 +39,32 @@ export const CellRowAction: React.FC<CellRowActionProps> = ({
3539
actionAppliedLabel,
3640
children,
3741
hidden,
38-
testId
42+
testId,
43+
tooltipContent
3944
}) => {
4045
const count = (showSubRowStates && subRowsAffected) || 0
4146

4247
return (
43-
<div
44-
className={cx(styles.rowActions, hidden && styles.hidden)}
45-
data-testid={testId}
48+
<Tooltip
49+
content={tooltipContent}
50+
placement="bottom-end"
51+
delay={[CELL_TOOLTIP_DELAY, 0]}
4652
>
47-
<Indicator
48-
count={count}
49-
tooltipContent={
50-
count &&
51-
`${count} ${pluralize('sub-row', count)} ${actionAppliedLabel}.`
52-
}
53+
<div
54+
className={cx(styles.rowActions, hidden && styles.hidden)}
55+
data-testid={testId}
5356
>
54-
{children}
55-
</Indicator>
56-
</div>
57+
<Indicator
58+
count={count}
59+
tooltipContent={
60+
count &&
61+
`${count} ${pluralize('sub-row', count)} ${actionAppliedLabel}.`
62+
}
63+
>
64+
{children}
65+
</Indicator>
66+
</div>
67+
</Tooltip>
5768
)
5869
}
5970

@@ -72,6 +83,7 @@ export const CellRowActions: React.FC<CellRowActionsProps> = ({
7283
subRowsAffected={selections}
7384
actionAppliedLabel={'selected'}
7485
testId={'row-action-checkbox'}
86+
tooltipContent={isRowSelected ? 'Unselect' : 'Select'}
7587
>
7688
<VSCodeCheckbox
7789
{...clickAndEnterProps(toggleRowSelection)}
@@ -83,6 +95,7 @@ export const CellRowActions: React.FC<CellRowActionsProps> = ({
8395
subRowsAffected={stars}
8496
actionAppliedLabel={'starred'}
8597
testId={'row-action-star'}
98+
tooltipContent={starred ? 'Remove Star' : 'Add Star'}
8699
>
87100
<div
88101
className={styles.starSwitch}

webview/src/experiments/components/table/styles.module.scss

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,16 @@ $workspace-row-edge-margin: $edge-padding - $cell-padding;
339339
}
340340

341341
.table.withExpColumnShadow {
342-
.tr > *:first-child:after {
343-
box-shadow: 3px 0px 3px $shadow;
342+
.tr > *:first-child {
343+
border-right-width: 0;
344+
345+
&:after {
346+
box-shadow: 3px 0px 3px $shadow;
347+
}
348+
349+
&:hover:before {
350+
border-right-width: 0;
351+
}
344352
}
345353
}
346354

@@ -375,10 +383,6 @@ $workspace-row-edge-margin: $edge-padding - $cell-padding;
375383
background-color: $header-bg-color;
376384
}
377385

378-
& > *:first-child:after {
379-
right: -1px;
380-
}
381-
382386
&:last-child,
383387
.firstLevelHeader {
384388
.paramHeaderCell,
@@ -430,6 +434,10 @@ $workspace-row-edge-margin: $edge-padding - $cell-padding;
430434
box-shadow: 0 5px 8px -2px $shadow;
431435
}
432436

437+
.td {
438+
line-height: 3rem;
439+
}
440+
433441
.innerCell {
434442
.rowActions {
435443
visibility: hidden;
@@ -541,6 +549,10 @@ $workspace-row-edge-margin: $edge-padding - $cell-padding;
541549
.placeholderHeaderCell {
542550
background-color: $header-bg-color;
543551
border-right: 1px solid $header-border-color;
552+
553+
&:last-child {
554+
border-right: none;
555+
}
544556
}
545557

546558
.headerCell {
@@ -615,8 +627,7 @@ $workspace-row-edge-margin: $edge-padding - $cell-padding;
615627
left: 50%;
616628
width: 2px;
617629
height: 100%;
618-
background-color: $header-fg-color;
619-
opacity: 0.5;
630+
background-color: $header-resizer-color;
620631
}
621632
}
622633

webview/src/shared/variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ $row-border-selected-color: var(--vscode-list-focusOutline);
1818
$header-bg-color: $bg-color;
1919
$header-border-color: $border-color;
2020
$meta-cell-color: var(--vscode-descriptionForeground);
21+
$header-resizer-color: var(--vscode-sash-hoverBorder);
2122

2223
$hover-background-color: var(--vscode-list-hoverBackground);
2324
$row-hover-background-color: var(--vscode-list-hoverBackground);

0 commit comments

Comments
 (0)