-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Runs table] Moves expand button to layout container and fixes sidebar scroll #6837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
627d64d
24d5504
98f0260
e11681d
781e980
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,18 +24,34 @@ limitations under the License. | |
|
||
.sidebar { | ||
max-width: 80vw; | ||
position: relative; | ||
} | ||
|
||
.resizer, | ||
.expand { | ||
.expand-collapsed-sidebar { | ||
@include tb-theme-foreground-prop(border-color, border); | ||
box-sizing: border-box; | ||
flex: 0 0; | ||
justify-self: stretch; | ||
} | ||
|
||
.expand { | ||
.expand-collapsed-sidebar { | ||
width: 20px; | ||
align-items: center; | ||
background: transparent; | ||
border-style: solid; | ||
border-width: 0 1px 0 0; | ||
color: inherit; | ||
contain: content; | ||
cursor: pointer; | ||
display: flex; | ||
justify-self: stretch; | ||
padding: 0; | ||
|
||
mat-icon { | ||
transform: rotate(-90deg); | ||
transform-origin: center; | ||
} | ||
} | ||
|
||
.resizer { | ||
|
@@ -63,20 +79,46 @@ limitations under the License. | |
} | ||
} | ||
|
||
.expand { | ||
align-items: center; | ||
background: transparent; | ||
border-style: solid; | ||
border-width: 0 1px 0 0; | ||
color: inherit; | ||
contain: content; | ||
cursor: pointer; | ||
.full-screen-toggle { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
opacity: 0; | ||
position: absolute; | ||
height: 100%; | ||
// Ensure the button is on the right side then add 2px for the drag target. | ||
left: calc(100% + 2px); | ||
top: 0; | ||
z-index: 1; | ||
display: flex; | ||
justify-self: stretch; | ||
padding: 0; | ||
align-items: center; | ||
|
||
mat-icon { | ||
transform: rotate(-90deg); | ||
transform-origin: center; | ||
&:hover { | ||
opacity: 0.8; | ||
} | ||
|
||
&.full-screen { | ||
left: unset; | ||
right: 0; | ||
} | ||
|
||
.full-screen-btn { | ||
$_arrow_size: 16px; | ||
$_arrow_button_size: calc($_arrow_size + 4px); | ||
|
||
background-color: gray; | ||
padding: 0; | ||
min-width: $_arrow_button_size; | ||
width: $_arrow_button_size; | ||
|
||
&.expand { | ||
border-radius: 0 $_arrow_button_size $_arrow_button_size 0; | ||
} | ||
|
||
&.collapse { | ||
border-radius: $_arrow_button_size 0 0 $_arrow_button_size; | ||
} | ||
|
||
.expand-collapse-icon { | ||
font-size: $_arrow_size; | ||
margin-right: 0; // Removes default | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ import {Store} from '@ngrx/store'; | |
import {fromEvent, Observable, Subject} from 'rxjs'; | ||
import {combineLatestWith, filter, map, takeUntil} from 'rxjs/operators'; | ||
import {MouseEventButtons} from '../../util/dom'; | ||
import {sideBarWidthChanged} from '../actions'; | ||
import {runsTableFullScreenToggled, sideBarWidthChanged} from '../actions'; | ||
import {State} from '../state'; | ||
import { | ||
getRunsTableFullScreen, | ||
|
@@ -34,7 +34,7 @@ import { | |
template: ` | ||
<button | ||
*ngIf="(width$ | async) === 0" | ||
class="expand" | ||
class="expand-collapsed-sidebar" | ||
(click)="expandSidebar()" | ||
> | ||
<mat-icon svgIcon="expand_more_24px"></mat-icon> | ||
|
@@ -47,6 +47,26 @@ import { | |
[style.maxWidth.%]="(runsTableFullScreen$ | async) ? 100 : ''" | ||
> | ||
<ng-content select="[sidebar]"></ng-content> | ||
<div | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copied from runs_data_table.ng.html |
||
class="full-screen-toggle" | ||
[ngClass]="{'full-screen': (runsTableFullScreen$ | async)}" | ||
> | ||
<button | ||
mat-button | ||
class="full-screen-btn" | ||
[ngClass]="(runsTableFullScreen$ | async) ? 'collapse' : 'expand'" | ||
(click)="toggleFullScreen()" | ||
> | ||
<mat-icon | ||
class="expand-collapse-icon" | ||
[svgIcon]=" | ||
(runsTableFullScreen$ | async) | ||
? 'arrow_back_24px' | ||
: 'arrow_forward_24px' | ||
" | ||
></mat-icon> | ||
</button> | ||
</div> | ||
</nav> | ||
<div | ||
*ngIf="(width$ | async) > 0" | ||
|
@@ -125,4 +145,8 @@ export class LayoutContainer implements OnDestroy { | |
}) | ||
); | ||
} | ||
|
||
toggleFullScreen() { | ||
this.store.dispatch(runsTableFullScreenToggled()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,13 @@ import {RunsTableColumn} from '../runs_table/types'; | |
`, | ||
styles: [ | ||
` | ||
:host { | ||
display: block; | ||
height: 100%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A minor preference: If we leave height unset then for fewer runs the horizontal scrollbar will be closer to the runs instead at the bottom of the page. Up to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this out. Unfortunately this also prevents vertical scroll entirely on longer tables - the height 100% is required to constrain the long table height to enable scrolling |
||
width: 100%; | ||
overflow: auto; | ||
} | ||
|
||
runs-table { | ||
height: 100%; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,11 @@ $_circle-size: 20px; | |
$_arrow_size: 16px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can delete $_arrow_size definition here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
:host { | ||
width: 100%; | ||
} | ||
min-width: 100%; | ||
|
||
:host { | ||
overflow-y: auto; | ||
width: 100%; | ||
& ::ng-deep tb-data-table .data-table { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This replaces the previous border-bottom of the .filter-row. It ensures that the entire table has a border-top, instead of just the part touching the filter row. |
||
@include tb-theme-foreground-prop(border-top, border, 1px solid); | ||
} | ||
} | ||
|
||
.color-container { | ||
|
@@ -72,49 +71,7 @@ tb-data-table-header-cell:last-of-type { | |
width: 40px; | ||
} | ||
|
||
.full-screen-toggle { | ||
opacity: 0; | ||
position: absolute; | ||
height: 100%; | ||
// Ensure the button is on the right side then add 2px for the drag target. | ||
left: calc(100% + 2px); | ||
top: 0; | ||
z-index: 1; | ||
display: flex; | ||
align-items: center; | ||
|
||
&:hover { | ||
opacity: 0.8; | ||
} | ||
|
||
&.full-screen { | ||
left: unset; | ||
right: 0; | ||
} | ||
|
||
.full-screen-btn { | ||
background-color: gray; | ||
padding: 0; | ||
min-width: $_arrow_size; | ||
width: $_arrow_size; | ||
|
||
&.expand { | ||
border-radius: 0 $_arrow_size $_arrow_size 0; | ||
} | ||
|
||
&.collapse { | ||
border-radius: $_arrow_size 0 0 $_arrow_size; | ||
} | ||
|
||
.expand-collapse-icon { | ||
font-size: $_arrow_size; | ||
width: $_arrow_size; | ||
} | ||
} | ||
} | ||
|
||
.filter-row { | ||
@include tb-theme-foreground-prop(border-bottom, border, 1px solid); | ||
display: flex; | ||
align-items: center; | ||
height: 48px; | ||
|
@@ -125,6 +82,3 @@ tb-data-table-header-cell:last-of-type { | |
flex-grow: 1; | ||
} | ||
} | ||
.table-container { | ||
overflow-x: auto; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to avoid conflict with .full-screen-toggle's .expand