Skip to content

Commit

Permalink
fix: disabled paginator and implemented own logic
Browse files Browse the repository at this point in the history
  • Loading branch information
EricSommerhalder committed Nov 13, 2023
1 parent 3f59922 commit a20a9f8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,15 @@ <h3 class="label mat-headline-6">
<!-- the value(s) of the incoming links -->
<a class="link link-value" *ngFor="let inRes of displayedIncomingLinkResources"
(click)="openResource(inRes.id)">{{inRes.resourceClassLabel}}: <strong>{{inRes.label}}</strong></a>
<mat-paginator *ngIf="numberOffAllIncomingLinkRes > amount_resources" [length]=numberOffAllIncomingLinkRes
<!-- <mat-paginator *ngIf="numberOffAllIncomingLinkRes > amount_resources" [length]=numberOffAllIncomingLinkRes
[pageSize]="amount_resources" [hidePageSize]="true" [pageIndex]="pageEvent.pageIndex"
(page)="goToPage($event)">
</mat-paginator>
</mat-paginator> -->
<div class="pagination" *ngIf="numberOffAllIncomingLinkRes > amount_resources">
<p>Show more</p>
<button [disabled]="pageEvent.pageIndex < 1" (click)="handleIncomingLinkBackward()"><mat-icon>chevron_left</mat-icon></button>
<button [disabled]="numberOffAllIncomingLinkRes / amount_resources <= pageEvent.pageIndex + 1" (click)="handleIncomingLinkForward()"><mat-icon>chevron_right</mat-icon></button>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,41 @@
margin: 0;
}

.pagination {
display: flex;
align-items: center;
button {
margin: 0 15px;
padding: 0;
background: transparent;
border: none;
cursor: pointer;
border-radius: 100%;
height: fit-content;
padding: 10px;
display: flex; //centers the icon

mat-icon {
color: $primary;
}

}

button:hover {
background-color: $cool_gray_300;
}

button:disabled {
opacity: 0.4;
cursor: not-allowed;
}

button:disabled:hover {
background-color: transparent;
}

}

@media screen and (max-width: 768px) {
.properties,
.incoming {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,23 @@ export class PropertiesComponent implements OnInit, OnChanges, OnDestroy {
this._getDisplayedIncomingLinkRes();
}

handleIncomingLinkForward(){
if(this.numberOffAllIncomingLinkRes / this.amount_resources > this.pageEvent.pageIndex + 1){
const newPage = new PageEvent();
newPage.pageIndex = this.pageEvent.pageIndex + 1;
this.goToPage(newPage);
}
}

handleIncomingLinkBackward(){
if (this.pageEvent.pageIndex > 0){
const newPage = new PageEvent();
newPage.pageIndex = this.pageEvent.pageIndex - 1;
this.goToPage(newPage);
}

}

/**
* opens resource
* @param linkValue
Expand Down

0 comments on commit a20a9f8

Please sign in to comment.