Improve sort preset display
Signed-off-by: trivernis <trivernis@protonmail.com>pull/12/head
parent
ece096fb86
commit
e431450a43
@ -0,0 +1,14 @@
|
||||
<button (click)="this.appClick.emit()"
|
||||
[matTooltipShowDelay]="1000"
|
||||
[matTooltip]="selectedPreset.toString()"
|
||||
class="sort-button"
|
||||
mat-flat-button>
|
||||
<i>Sort: </i>
|
||||
<span *ngFor="let key of this.selectedPreset.sortKeys" class="sort-key">
|
||||
<span class="sort-key-type">{{key.sortType}}</span>
|
||||
<span *ngIf="key.sortType === 'Namespace'" class="sort-key-namespace"> {{key.namespaceName}}</span>
|
||||
<ng-icon *ngIf="key.sortDirection === 'Ascending'" class="sort-key-direction" name="matExpandLess"></ng-icon>
|
||||
<ng-icon *ngIf="key.sortDirection === 'Descending'" class="sort-key-direction" name="matExpandMore"></ng-icon>
|
||||
<span class="key-divider">| </span>
|
||||
</span>
|
||||
</button>
|
@ -0,0 +1,27 @@
|
||||
@import "src/colors";
|
||||
|
||||
.sort-button {
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
background-color: $background-lighter-10;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sort-key-direction {
|
||||
font-size: 1.5em;
|
||||
vertical-align: bottom;
|
||||
margin-bottom: 0.6em;
|
||||
}
|
||||
|
||||
.sort-key-type {
|
||||
color: $primary-lighter-50
|
||||
}
|
||||
|
||||
.sort-key-namespace {
|
||||
color: $accent-lighter-10;
|
||||
}
|
||||
|
||||
.sort-key:last-child .key-divider {
|
||||
display: none;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SortButtonComponent } from './sort-button.component';
|
||||
|
||||
describe('SortButtonComponent', () => {
|
||||
let component: SortButtonComponent;
|
||||
let fixture: ComponentFixture<SortButtonComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ SortButtonComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SortButtonComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,17 @@
|
||||
import {ChangeDetectionStrategy, Component, EventEmitter, Input, Output} from "@angular/core";
|
||||
import {SortingPreset} from "../../../../../../api/models/SortingPreset";
|
||||
|
||||
@Component({
|
||||
selector: "app-sort-button",
|
||||
templateUrl: "./sort-button.component.html",
|
||||
styleUrls: ["./sort-button.component.scss"],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class SortButtonComponent {
|
||||
|
||||
@Input() selectedPreset!: SortingPreset;
|
||||
@Output() appClick = new EventEmitter<void>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue