Frontend: Added PeopleGridComponent
This commit is contained in:
1 parent
02b4caa6ef
commit
c8408f9f53
3 files changed
+65
No files matched your search
@@ -0,0 +1,20 @@
|
|||||||
|
.people-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-results {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px;
|
||||||
|
color: #666;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<div *ngIf="loading" class="loading-container">
|
||||||
|
<div class="spinner-border text-primary" role="status">
|
||||||
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="!loading && displayedPeople.length === 0" class="no-results">
|
||||||
|
<p>No people found matching your criteria</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="!loading && displayedPeople.length > 0" class="people-grid">
|
||||||
|
<div *ngFor="let person of displayedPeople">
|
||||||
|
<app-person-card [person]="person"></app-person-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
||||||
|
import { Person } from '../../../shared/models/person.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-people-grid',
|
||||||
|
templateUrl: './people-grid.component.html',
|
||||||
|
styleUrls: ['./people-grid.component.css']
|
||||||
|
})
|
||||||
|
export class PeopleGridComponent implements OnInit, OnChanges {
|
||||||
|
@Input() people: Person[] = [];
|
||||||
|
@Input() loading: boolean = false;
|
||||||
|
|
||||||
|
displayedPeople: Person[] = [];
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.updateDisplayedPeople();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
if (changes['people']) {
|
||||||
|
this.updateDisplayedPeople();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateDisplayedPeople() {
|
||||||
|
this.displayedPeople = [...this.people];
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user