Skip to content
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

Change labels filter to dynamic height, fixed width, and shadow scroll bar #163

Merged
merged 8 commits into from
Jul 23, 2023
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
::ng-deep.mat-menu-content:not(:empty) {
/* Override mat-menu-content's non-empty default CSS. */
padding-top: 0px !important;
padding-bottom: 0px !important;
}

::ng-deep.mat-menu-panel {
/* Override mat-menu-panel's default CSS. */
width: 280px;
max-width: none !important;
}

.popup-container {
padding-top: 0px;
padding-left: 15px;
padding-right: 15px;
flex-direction: column;
}

Expand All @@ -10,26 +19,80 @@
}

.scroll-container {
height: 400px;
max-height: 400px;
width: 100%;
overflow-y: auto;
position: relative;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}

/* Ref: https://css-scroll-shadows.vercel.app */
.scroll-container::before {
pointer-events: none;
content: '';
position: absolute;
z-index: 2;
height: 7px;
width: 100%;
display: block;
background-image: linear-gradient(to bottom, white 66%, transparent);
}

.scroll-container::after {
pointer-events: none;
content: '';
position: sticky;
z-index: 2;
top: 100%;
height: 7px;
width: 100%;
display: block;
background-image: linear-gradient(to top, white 66%, transparent);
}

.scroll-container-wrapper {
position: relative;
}

.scroll-container-wrapper::before {
pointer-events: none;
content: '';
position: absolute;
z-index: 1;
top: 0;
left: 0;
right: 0;
height: 5px;
background-image: radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.7), transparent);
}

.scroll-container-wrapper::after {
pointer-events: none;
content: '';
position: absolute;
z-index: 1;
bottom: 0;
left: 0;
right: 0;
height: 5px;
background-image: radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.7), transparent);
}

.scroll-container::-webkit-scrollbar {
display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}

.flexbox-container {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}

.scroll-container::-webkit-scrollbar {
display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}

.input-field {
width: 100%;
width: calc(100% - (2 * 15px)); /* To account for left and right padding. */
padding: 0 15px;
}

.list-option {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,36 @@
<input #input matInput placeholder="Find labels" />
</mat-form-field>

<div class="scroll-container">
<mat-selection-list [(ngModel)]="selectedLabelNames" (selectionChange)="selectedLabels.next(selectedLabelNames)">
<mat-list-option
#option
*ngFor="let label of allLabels"
[value]="label.name"
[selected]="selectedLabelNames.includes(label.name)"
class="list-option"
[class.hidden]="filter(input.value, label.name)"
>
<div class="flexbox-container">
<button mat-icon-button *ngIf="!hiddenLabelNames.has(label.name)" (click)="hide(label.name); $event.stopPropagation()">
<mat-icon>visibility</mat-icon>
</button>
<button mat-icon-button *ngIf="hiddenLabelNames.has(label.name)" (click)="show(label.name); $event.stopPropagation()">
<mat-icon>visibility_off</mat-icon>
</button>
<div class="scroll-container-wrapper">
<div class="scroll-container">
<mat-selection-list [(ngModel)]="selectedLabelNames" (selectionChange)="selectedLabels.next(selectedLabelNames)">
<mat-list-option
#option
*ngFor="let label of allLabels"
[value]="label.name"
[selected]="selectedLabelNames.includes(label.name)"
class="list-option"
[class.hidden]="filter(input.value, label.name)"
>
<div class="flexbox-container">
<button mat-icon-button *ngIf="!hiddenLabelNames.has(label.name)" (click)="hide(label.name); $event.stopPropagation()">
<mat-icon>visibility</mat-icon>
</button>
<button mat-icon-button *ngIf="hiddenLabelNames.has(label.name)" (click)="show(label.name); $event.stopPropagation()">
<mat-icon>visibility_off</mat-icon>
</button>

<mat-chip
[ngStyle]="labelService.setLabelStyle(label.color)"
[disabled]="hiddenLabelNames.has(label.name)"
(click)="simulateClick(option); $event.stopPropagation()"
>
{{ label.name }}
</mat-chip>
</div>
</mat-list-option>
</mat-selection-list>
<mat-chip
[ngStyle]="labelService.setLabelStyle(label.color)"
[disabled]="hiddenLabelNames.has(label.name)"
(click)="simulateClick(option); $event.stopPropagation()"
>
{{ label.name }}
</mat-chip>
</div>
</mat-list-option>
</mat-selection-list>
</div>
</div>
</div>
</mat-menu>
Loading