add animation + click redirection to UserCollection info

This commit is contained in:
X4Lo committed 2024-04-05 03:25:04 +00:00
1 parent c2da54a641
commit 89f8044c0b
3 files changed
+43 -5

No files matched your search

@@ -1,3 +1,19 @@
.list-item-1 {
padding-top: 1px;
}
.list-title{
font-size: 20px;
}
.list-title:hover {
color: var(--aruze-blue)
}
.list-line{
border-radius: 1px;
padding: 2px;
}
.list-line:hover {
background-color: aliceblue;
}
@@ -1,7 +1,7 @@
<div class="d-flex align-items-start gap-2">
<img [src]="getPostPath()" width="70" height="105" class="" alt="">
<div class="d-flex align-items-start gap-2 list-line" @fadeInOut>
<img [src]="getPostPath()" width="70" height="105" class="" alt="List poster" (click)="redirectTo()">
<div class="flex-grow-1 list-item-1">
<h6 class="mb-0">{{list.name}}</h6>
<h6 class="mb-0 list-title" (click)="redirectTo()">{{list.name}}</h6>
<p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p>
<p class="mb-0">Contains: {{list.listEntries.length}} title(s)</p>
</div>
@@ -1,17 +1,31 @@
import { Component, Input} from '@angular/core';
import { List } from '../../../shared/models/list.model';
import { ListService } from '../../../core/services/list.service';
import { DateFormatPipe } from '../../../core/pipes/date-format/date-format.pipe';
import { Router } from '@angular/router';
import { trigger, transition, style, animate } from '@angular/animations';
@Component({
selector: 'app-user-list-item',
templateUrl: './user-list-item.component.html',
styleUrls: ['./user-list-item.component.css'],
animations: [
trigger('fadeInOut', [
transition(':enter', [
// :enter is alias for 'void => *'
style({ opacity: 0 }),
animate('0.5s ease-out', style({ opacity: 1 })),
]),
transition(':leave', [
// :leave is alias for '* => void'
animate('0.5s ease-in', style({ opacity: 0 })),
]),
]),
],
})
export class UserListItemComponent {
@Input() list!: List;
constructor(private listService: ListService) {}
constructor(private listService: ListService, private router: Router) {}
getPostPath() {
if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256';
@@ -24,4 +38,12 @@ export class UserListItemComponent {
return this.list.createdAt.toString();
}
redirectTo(): void {
this.router.navigate([`/lists/${this.list.id}`]);
}
deleteList() {
this.listService.deleteList(this.list.id);
}
}