Skip to content

Commit

Permalink
fixing broken IAS icons site
Browse files Browse the repository at this point in the history
  • Loading branch information
ldchrist committed Dec 6, 2022
1 parent fce9457 commit be492c5
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ import {
tap,
withLatestFrom,
} from 'rxjs/operators';
import { IconType } from '@ux-aspects/ux-aspects';
import { LowerCasePipe } from '@angular/common';
import { SearchFiltersService } from 'src/app/app.filters'
import { appendFile } from 'fs';

// const FULL_ICON_LIST = require('../../package/dist/ias-icons.json');

const FULL_ICON_LIST = require('../../dist/generated-font/dist/ias-icons.json');

Expand All @@ -40,13 +34,6 @@ export class AppComponent implements OnInit, OnDestroy {

showDetailedList: boolean;

showDropdownFilter: boolean;

constructor(
public searchFilterService: SearchFiltersService
) {}


ngOnInit(): void {
this.iconInfoListSubscription = this.subscribeToIconInfoListChanges();
}
Expand All @@ -63,43 +50,36 @@ export class AppComponent implements OnInit, OnDestroy {
this.showDetailedList = true;
}

onFilterDropdownClick(): void {
this.showDropdownFilter = true;
}

private subscribeToIconInfoListChanges(): Subscription {
return combineLatest([
of(FULL_ICON_LIST).pipe(
map((icons: IconInfo[]) => {
return icons.sort((a: IconInfo, b: IconInfo) =>
a.glyph.localeCompare(b.glyph)
)
);
})
),
this.searchFormControl.valueChanges.pipe(
debounceTime(200),
startWith(''),
startWith('')
),
])
.pipe(
map(([icons, search]) => { // Do filter comparison in here
map(([icons, search]) => {
if (search) {
let combined_filtered_array = []
let filter_by_name= icons.filter((icon: IconInfo) => {
// return icon.name.indexOf(search) > -1;
return icon.name.toLocaleLowerCase().includes(search.toLowerCase()); // equals was returning strings as not equal, so using .includes compares them properly

return icon.name.indexOf(search) > -1;
});
let filter_by_uses= icons.filter((icon: IconInfo) => {

return icon.uses.indexOf(search) > -1;
});
combined_filtered_array.push(...filter_by_name)
combined_filtered_array.push(...filter_by_uses)
combined_filtered_array = [...new Set(combined_filtered_array)]

return combined_filtered_array
// Returning the icon if it can find the search within the arrary

}

return icons;
Expand Down

0 comments on commit be492c5

Please sign in to comment.