mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-11 05:13:02 -05:00
refactor(challenge-1): augment challenge
Create city store Camelcase some student and teacher interface's field to remove lint warnings Move CardComponent's template to typescript file within decorator
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
<div
|
||||
class="border-2 border-black rounded-md p-4 w-fit flex flex-col gap-3"
|
||||
[class]="customClass">
|
||||
<img
|
||||
*ngIf="type === CardType.TEACHER"
|
||||
src="assets/img/teacher.png"
|
||||
width="200px" />
|
||||
<img
|
||||
*ngIf="type === CardType.STUDENT"
|
||||
src="assets/img/student.webp"
|
||||
width="200px" />
|
||||
|
||||
<section>
|
||||
<app-list-item
|
||||
*ngFor="let item of list"
|
||||
[name]="item.firstname"
|
||||
[id]="item.id"
|
||||
[type]="type">
|
||||
</app-list-item>
|
||||
</section>
|
||||
|
||||
<button
|
||||
class="border border-blue-500 bg-blue-300 p-2 rounded-sm"
|
||||
(click)="addNewItem()">
|
||||
Add
|
||||
</button>
|
||||
</div>
|
||||
@@ -8,7 +8,34 @@ import { ListItemComponent } from '../list-item/list-item.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card',
|
||||
templateUrl: './card.component.html',
|
||||
template: `
|
||||
<div
|
||||
class="flex w-fit flex-col gap-3 rounded-md border-2 border-black p-4"
|
||||
[class]="customClass">
|
||||
<img
|
||||
*ngIf="type === CardType.TEACHER"
|
||||
src="assets/img/teacher.png"
|
||||
width="200px" />
|
||||
<img
|
||||
*ngIf="type === CardType.STUDENT"
|
||||
src="assets/img/student.webp"
|
||||
width="200px" />
|
||||
|
||||
<section>
|
||||
<app-list-item
|
||||
*ngFor="let item of list"
|
||||
[name]="item.firstName"
|
||||
[id]="item.id"
|
||||
[type]="type"></app-list-item>
|
||||
</section>
|
||||
|
||||
<button
|
||||
class="rounded-sm border border-blue-500 bg-blue-300 p-2"
|
||||
(click)="addNewItem()">
|
||||
Add
|
||||
</button>
|
||||
</div>
|
||||
`,
|
||||
standalone: true,
|
||||
imports: [NgIf, NgFor, ListItemComponent],
|
||||
})
|
||||
@@ -21,7 +48,7 @@ export class CardComponent {
|
||||
|
||||
constructor(
|
||||
private teacherStore: TeacherStore,
|
||||
private studentStore: StudentStore
|
||||
private studentStore: StudentStore,
|
||||
) {}
|
||||
|
||||
addNewItem() {
|
||||
|
||||
Reference in New Issue
Block a user