Skip to content

Commit

Permalink
Merge pull request #500 from G-Core/deselect-all
Browse files Browse the repository at this point in the history
Deselect all
  • Loading branch information
IgorSinyak authored Oct 30, 2023
2 parents 4b34ec8 + d51f1a8 commit 7504dac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/app/components/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ <h2 class="gc-filter-title">Source</h2>
><input type="checkbox" [formControl]="control" /> <span>{{ categories[i].name }}</span></label
>
</form>
<button class="gc-select-all" (click)="selectAll()">Select All</button>
<div class="gc-select-all-buttons">
<button class="gc-select-all" (click)="selectAll(true)">Select All</button>
<button class="gc-select-all" (click)="selectAll(false)">Deselect All</button>
</div>
</div>
<gc-left-bar-menu [class.expanded]="isMenuExpanded" [isHomePage]="true" class="search-mobile-menu"> </gc-left-bar-menu>
<div class="gc-content-wrapper">
Expand Down
5 changes: 5 additions & 0 deletions src/app/components/search/search.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
position: sticky;
top: calc(72px + 36px);

.gc-select-all-buttons {
display: flex;
justify-content: space-between;
}

.gc-select-all {
margin-top: 1.5rem;
font-size: 0.875rem;
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ export class SearchComponent implements OnInit, OnDestroy {
this.page$.next(pageNumber);
}

public selectAll(): void {
public selectAll(value: boolean): void {
const formArray = this.filterForm.get('product') as FormArray;
formArray.patchValue(formArray.controls.map(() => true));
formArray.patchValue(formArray.controls.map(() => value));
}

public search(key: string): void {
Expand Down

0 comments on commit 7504dac

Please sign in to comment.