Skip to content

Commit 40cb36e

Browse files
authored
Fix minor table bugs (#3192)
* Fix small table styling bugs * Fix bugs * Fix missing border * Fix more unspotted bugs * Clean up * Fix typo
1 parent 1a67d5c commit 40cb36e

File tree

3 files changed

+70
-62
lines changed

3 files changed

+70
-62
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ export const TableBody: React.FC<
7272
<tbody>
7373
<tr className={cx(styles.tr, styles.previousCommitsRow)}>
7474
<td className={styles.th}>Previous Commits</td>
75-
<td colSpan={row.getAllCells().length - 1}></td>
75+
<td
76+
className={styles.th}
77+
colSpan={row.getAllCells().length - 1}
78+
></td>
7679
</tr>
7780
</tbody>
7881
)}

webview/src/experiments/components/table/header/TableHeaderCell.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const getHeaderPropsArgs = (
5151
[styles.paramHeaderCell]: columnWithGroup.group === ColumnType.PARAMS,
5252
[styles.metricHeaderCell]: columnWithGroup.group === ColumnType.METRICS,
5353
[styles.depHeaderCell]: columnWithGroup.group === ColumnType.DEPS,
54+
[styles.createdHeaderCell]: header.id === 'Created',
5455
[styles.firstLevelHeader]: isFirstLevelHeader(header.column.id),
5556
[styles.leafHeader]: header.subHeaders === undefined,
5657
[styles.menuEnabled]: sortEnabled,

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

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,29 @@ $bullet-size: calc(var(--design-unit) * 4px);
5656
}
5757
}
5858

59+
%cellBorderLeft {
60+
content: '';
61+
position: absolute;
62+
bottom: 0;
63+
left: 0;
64+
width: 1px;
65+
height: 100%;
66+
top: 0;
67+
background-color: transparent;
68+
}
69+
70+
%headerCellBorderBottom {
71+
content: '';
72+
position: absolute;
73+
bottom: 0;
74+
top: auto;
75+
left: 1px;
76+
width: 100%;
77+
height: 1px;
78+
display: block;
79+
background-color: $header-border-color;
80+
}
81+
5982
.hidden {
6083
visibility: hidden;
6184
}
@@ -263,7 +286,7 @@ $bullet-size: calc(var(--design-unit) * 4px);
263286
width: fit-content;
264287

265288
&:hover.rowSelected {
266-
&:after {
289+
&::after {
267290
box-shadow: inset 0 0 20px $shadow;
268291
content: '';
269292
top: 0;
@@ -275,42 +298,30 @@ $bullet-size: calc(var(--design-unit) * 4px);
275298
pointer-events: none;
276299
}
277300

278-
td:not(.experimentCell):hover .innerCell,
279-
td:hover .timestampInnerCell,
280-
td:hover + td .innerCell,
281-
td:hover + td .timestampInnerCell {
282-
border-left-color: $row-border-selected-color;
301+
td:not(.experimentCell):hover::before,
302+
td:hover + td::before {
303+
background-color: $row-border-selected-color;
283304
}
284305
}
285306

286-
&:hover:not(.rowSelected),
287-
&.rowFocused:not(.rowSelected) {
288-
:not(.experimentCell) {
289-
.innerCell,
290-
.timestampInnerCell {
291-
border-right-color: $border-color;
292-
}
293-
}
294-
295-
.experimentCell + td {
296-
.innerCell,
297-
.timestampInnerCell {
298-
border-left-color: $border-color;
299-
}
300-
}
301-
307+
&:hover:not(.rowSelected) {
302308
td:not(.experimentCell),
303309
.experimentCell::before {
304310
background-color: $row-hover-background-color;
305311
}
312+
313+
td:not(.experimentCell):hover::before,
314+
td:hover + td::before {
315+
background-color: $border-color;
316+
}
306317
}
307318

308319
> *:first-child {
309320
position: sticky;
310321
left: 0;
311322
z-index: 3;
312323

313-
&:after {
324+
&::after {
314325
content: '';
315326
height: 100%;
316327
position: absolute;
@@ -320,20 +331,6 @@ $bullet-size: calc(var(--design-unit) * 4px);
320331
transition: box-shadow 0.25s;
321332
}
322333

323-
&.headerCell,
324-
&.placeholderHeaderCell {
325-
> div::after {
326-
content: '';
327-
position: absolute;
328-
top: 0;
329-
right: -2px;
330-
width: 1px;
331-
height: 100%;
332-
background-color: $header-border-color;
333-
display: block;
334-
}
335-
}
336-
337334
&.headerCell {
338335
&::after {
339336
bottom: auto;
@@ -342,15 +339,7 @@ $bullet-size: calc(var(--design-unit) * 4px);
342339
}
343340

344341
&::before {
345-
content: '';
346-
position: absolute;
347-
bottom: 0;
348-
left: 0;
349-
width: 100%;
350-
height: 1px;
351-
background-color: $header-border-color;
352-
display: block;
353-
top: auto;
342+
@extend %headerCellBorderBottom;
354343
}
355344
}
356345
}
@@ -540,10 +529,8 @@ $bullet-size: calc(var(--design-unit) * 4px);
540529
line-height: 2rem;
541530
align-items: center;
542531

543-
.innerCell,
544-
.timestampInnerCell {
545-
border-right: 1px solid transparent;
546-
border-left: 1px solid transparent;
532+
&:not(.experimentCell)::before {
533+
@extend %cellBorderLeft;
547534
}
548535

549536
&:first-child {
@@ -558,10 +545,8 @@ $bullet-size: calc(var(--design-unit) * 4px);
558545
}
559546
}
560547
}
561-
.experimentCell {
562-
border-right: none;
563-
border-left: none;
564548

549+
.experimentCell {
565550
.innerCell {
566551
display: flex;
567552
flex-flow: row nowrap;
@@ -609,12 +594,7 @@ $bullet-size: calc(var(--design-unit) * 4px);
609594
}
610595

611596
&::before {
612-
content: '';
613-
position: absolute;
614-
top: 0;
615-
left: -2px;
616-
height: 100%;
617-
width: 1px;
597+
@extend %cellBorderLeft;
618598
background-color: $header-border-color;
619599
}
620600

@@ -633,7 +613,7 @@ $bullet-size: calc(var(--design-unit) * 4px);
633613
content: '';
634614
position: absolute;
635615
bottom: 0;
636-
left: 0;
616+
left: 1px;
637617
width: 100%;
638618
height: 1px;
639619
background-color: $header-border-color;
@@ -649,6 +629,10 @@ $bullet-size: calc(var(--design-unit) * 4px);
649629
outline-style: dashed;
650630
outline-color: $header-dnd-outline;
651631
outline-offset: -4px;
632+
633+
.iconMenu ul[role='menu'] {
634+
background-color: transparent;
635+
}
652636
}
653637
}
654638

@@ -663,6 +647,16 @@ $bullet-size: calc(var(--design-unit) * 4px);
663647
.th {
664648
font-size: 0.6rem;
665649
padding-left: 16px;
650+
651+
&::before {
652+
display: none;
653+
}
654+
}
655+
656+
&:hover {
657+
.th:not(.experimentCell) {
658+
background: $bg-color;
659+
}
666660
}
667661
}
668662
}
@@ -869,11 +863,21 @@ $bullet-size: calc(var(--design-unit) * 4px);
869863
@extend %truncateLeftChild;
870864
font-size: 0.7em;
871865
}
866+
872867
.timestampTime {
873868
@extend %truncateLeftChild;
874869
font-size: 0.9em;
875870
}
876871

872+
.createdHeaderCell .iconMenu {
873+
left: auto;
874+
right: 0;
875+
876+
ul[role='menu'] {
877+
margin: 0 4px 0 0;
878+
}
879+
}
880+
877881
.timestampHeader {
878882
@extend %headerCellPadding;
879883
overflow-x: hidden;
@@ -946,7 +950,7 @@ $badge-size: 0.85rem;
946950
}
947951

948952
.experimentCell {
949-
&:before {
953+
&::before {
950954
content: '';
951955
top: 0;
952956
right: 0;

0 commit comments

Comments
 (0)