fix entry card not disapearing after remove from library

This commit is contained in:
X4Lo committed 2024-04-28 22:03:24 +01:00
1 parent 561f27b065
commit 42726c5881
4 files changed
+43 -8

No files matched your search

@@ -1,4 +1,6 @@
<!-- Entries Container/Grid -->
<div class="movies-container">
<app-main-card *ngFor="let entry of entries" [entry]="entry"></app-main-card>
<ng-container *ngFor="let entry of entries">
<app-main-card [entry]="entry" (removedEvent)="entryRemoved($event)" @animateDestroy></app-main-card>
</ng-container>
</div>
@@ -1,11 +1,31 @@
import { Component, Input } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Entry } from '../../../../shared/models/entry.model';
import { Event } from '@angular/router';
import {
animate,
state,
style,
transition,
trigger,
} from '@angular/animations';
@Component({
selector: 'app-dynamic-entry-list',
templateUrl: './dynamic-entry-list.component.html',
styleUrls: ['./dynamic-entry-list.component.css'],
animations: [
trigger('animateDestroy', [
state('void', style({ opacity: '0' })),
transition('* => void', animate('500ms ease')),
]),
],
})
export class DynamicEntryListComponent {
@Output() removedEvent = new EventEmitter();
@Input() entries: Entry[] = [];
entryRemoved(event: Event) {
// ? emit (entry removed) to library
this.removedEvent.emit(event);
}
}