add animation + click redirection to UserCollection info
This commit is contained in:
1 parent
c2da54a641
commit
89f8044c0b
3 files changed
+44
-6
No files matched your search
@@ -1,3 +1,19 @@
|
|||||||
.list-item-1 {
|
.list-item-1 {
|
||||||
padding-top: 1px;
|
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">
|
<div class="d-flex align-items-start gap-2 list-line" @fadeInOut>
|
||||||
<img [src]="getPostPath()" width="70" height="105" class="" alt="">
|
<img [src]="getPostPath()" width="70" height="105" class="" alt="List poster" (click)="redirectTo()">
|
||||||
<div class="flex-grow-1 list-item-1">
|
<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">Created: {{getCreatedDate() | dateFormat}}</p>
|
||||||
<p class="mb-0">Contains: {{list.listEntries.length}} title(s)</p>
|
<p class="mb-0">Contains: {{list.listEntries.length}} title(s)</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,17 +1,31 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input} from '@angular/core';
|
||||||
import { List } from '../../../shared/models/list.model';
|
import { List } from '../../../shared/models/list.model';
|
||||||
import { ListService } from '../../../core/services/list.service';
|
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({
|
@Component({
|
||||||
selector: 'app-user-list-item',
|
selector: 'app-user-list-item',
|
||||||
templateUrl: './user-list-item.component.html',
|
templateUrl: './user-list-item.component.html',
|
||||||
styleUrls: ['./user-list-item.component.css'],
|
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 {
|
export class UserListItemComponent {
|
||||||
@Input() list!: List;
|
@Input() list!: List;
|
||||||
|
|
||||||
constructor(private listService: ListService) {}
|
constructor(private listService: ListService, private router: Router) {}
|
||||||
|
|
||||||
getPostPath() {
|
getPostPath() {
|
||||||
if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256';
|
if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256';
|
||||||
@@ -24,4 +38,12 @@ export class UserListItemComponent {
|
|||||||
|
|
||||||
return this.list.createdAt.toString();
|
return this.list.createdAt.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
redirectTo(): void {
|
||||||
|
this.router.navigate([`/lists/${this.list.id}`]);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteList() {
|
||||||
|
this.listService.deleteList(this.list.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user