add user list item component

This commit is contained in:
X4Lo committed 2024-04-02 03:41:59 +00:00
1 parent 8892b48dc9
commit 65fa3e9fe5
4 files changed
+58

No files matched your search

@@ -0,0 +1,10 @@
<div class="d-flex align-items-center gap-3">
<img [src]="getPostPath()" width="45" height="45" class="rounded-circle" alt="">
<div class="flex-grow-1">
<h6 class="mb-0">{{list.name}}</h6>
<p class="mb-0">Created: {{getCreatedDate() | dateFormat}}</p>
</div>
<!-- <div class="form-check form-check-inline me-0">
<input class="form-check-input ms-0" type="checkbox">
</div> -->
</div>
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserListItemComponent } from './user-list-item.component';
describe('UserListItemComponent', () => {
let component: UserListItemComponent;
let fixture: ComponentFixture<UserListItemComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [UserListItemComponent]
});
fixture = TestBed.createComponent(UserListItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,27 @@
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';
@Component({
selector: 'app-user-list-item',
templateUrl: './user-list-item.component.html',
styleUrls: ['./user-list-item.component.css'],
})
export class UserListItemComponent {
@Input() list!: List;
constructor(private listService: ListService) {}
getPostPath() {
if (this.list.poster_path == null) return 'https://pic.pnnet.dev/256x256';
return `https://image.tmdb.org/t/p/w500` + this.list.poster_path;
}
getCreatedDate(): string {
if (this.list.createdAt == null) return '';
return this.list.createdAt.toString();
}
}