Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 2x 2x 2x 2x 2x | import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { DeviceType } from 'ish-core/models/viewtype/viewtype.types'; /** * The Search Result Component displays a list of products as the result of a search and emits events for changing view type or sorting of the list. * It uses the {@link ProductListToolbarComponent} to provide list actions and {@link ProductListComponent} for the product list. * * @example * <ish-search-result * [searchTerm]="searchTerm" * [totalItems]="totalItems$ | async" * ></ish-search-result> */ @Component({ selector: 'ish-search-result', templateUrl: './search-result.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class SearchResultComponent implements OnInit, OnChanges { /** * The the search term leading to the displayed result. */ @Input({ required: true }) searchTerm: string; /** * The total number of product search results (might be different from products.length if paging is applied). */ @Input({ required: true }) totalItems: number; @Input() deviceType: DeviceType; isCollapsed = false; ngOnInit() { this.isCollapsed = this.deviceType === 'mobile'; } ngOnChanges(changes: SimpleChanges) { Iif (!SSR) { window.scroll(0, 0); } Iif (changes.deviceType) { this.isCollapsed = this.deviceType === 'mobile'; } } toggle() { this.isCollapsed = !this.isCollapsed; Iif (!SSR) { window.scroll(0, 0); } } } |