Skip to content

Commit

Permalink
♻️ use signal input
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfriesen committed Jan 18, 2024
1 parent ce20416 commit 305c207
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/app/components/thumb/thumb.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import {
Component,
ChangeDetectionStrategy,
inject,
Input,
computed,
signal,
input,
} from '@angular/core';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';

Expand All @@ -21,15 +20,10 @@ import { PreviewService } from '@app/services/preview.service';
export class ThumbnailComponent {
private readonly pagesPreviews = inject(PreviewService).pagesPreviews;

@Input()
set pageIndex(value: number) {
this.currentPageIndex.set(value);
}

readonly currentPageIndex = signal<number | undefined>(undefined);
pageIndex = input.required<number>();

readonly imageSrc = computed(() => {
const index = this.currentPageIndex();
const index = this.pageIndex();
const found = this.pagesPreviews()?.find(
(preview) => preview.pageIndex === index
);
Expand Down

0 comments on commit 305c207

Please sign in to comment.