Skip to content

Commit

Permalink
added filter to pages
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiaswright committed Nov 29, 2023
1 parent 0ac7f62 commit 7db7046
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<app-header></app-header>
<div class="container">
<app-intro></app-intro>

<!-- <input *ngIf="isHome" class="form-control form-control-lg" type="text" placeholder="Filter causes" aria-label=".form-control-lg example" [(ngModel)]="filterBy"> -->
<router-outlet></router-outlet>
<app-footer></app-footer>
</div>
Expand Down
16 changes: 8 additions & 8 deletions src/app/color-list/color-list.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<input class="form-control form-control-lg" type="text" placeholder="Filter causes" aria-label=".form-control-lg example" [(ngModel)]="filterBy">

<input *ngIf="isHome" class="form-control form-control-lg" type="text" placeholder="Filter causes" aria-label=".form-control-lg example" [(ngModel)]="filterBy">

<div class="row">
<div class="col-4 swatches" [title]="item.causeFull" *ngFor ="let item of list | filter: filterBy: 'cause'">
<app-swatch [colorData]="item.colorData"></app-swatch>
<app-color-card [cause]="item.cause" [colorName]="item.colorData.displayName"></app-color-card>
</div>
</div>
<h2 *ngIf="!isHome">{{title}}</h2>
<div class="row">
<div class="col-4 swatches" [title]="item.causeFull" *ngFor ="let item of list | filter: filterBy: 'cause'">
<app-swatch [colorData]="item.colorData"></app-swatch>
<app-color-card [cause]="item.cause" [colorName]="item.colorData.displayName"></app-color-card>
</div>
</div>
6 changes: 5 additions & 1 deletion src/app/color-list/color-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ import { Component, OnInit, Input } from '@angular/core';
export class ColorListComponent implements OnInit {
@Input() colorList: any
@Input() isHome: any
@Input() title: any;
list: any[] = [];
filterBy: any;


constructor() { }

constructor() {}

ngOnInit() {
this.list = this.colorList;
this.AddToolTips();
// this.title = this.colorList[0].htmlcolor
}

private AddToolTips() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/color-page/color-page.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<ng-container *ngIf="isValidColor; else infoText">
<h2 [style.color]= "color">{{title}}</h2>
<app-color-list [colorList]="list" [isHome] = false></app-color-list>
<!-- <h2 [style.color]= "color">{{title}}</h2> -->
<app-color-list [colorList]="list" [isHome]=false [title]="title"></app-color-list>
</ng-container>
<ng-template #infoText>
<strong>This color does not exist.</strong>
Expand Down

0 comments on commit 7db7046

Please sign in to comment.