<!--
  ~ Copyright (C) 2022 StApps
  ~ This program is free software: you can redistribute it and/or modify it
  ~ under the terms of the GNU General Public License as published by the Free
  ~ Software Foundation, version 3.
  ~
  ~ This program is distributed in the hope that it will be useful, but WITHOUT
  ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  ~ more details.
  ~
  ~ You should have received a copy of the GNU General Public License along with
  ~ this program. If not, see <https://www.gnu.org/licenses/>.
  -->

<ion-header>
  <ion-toolbar color="primary" mode="ios">
    <ion-buttons slot="start">
      <ion-back-button></ion-back-button>
    </ion-buttons>
    <ion-title>{{ 'hebisSearch.title' | translate }}</ion-title>
  </ion-toolbar>
  <ion-toolbar color="primary" mode="ios">
    <ion-searchbar
      (ngModelChange)="searchStringChanged($event)"
      (keyup.enter)="hideKeyboard()"
      (search)="hideKeyboard()"
      [(ngModel)]="queryText"
      mode="md"
      placeholder="{{ 'hebisSearch.search_bar.placeholder' | translate }}"
      showClearButton="always"
      type="search"
      enterkeyhint="search"
    >
    </ion-searchbar>
  </ion-toolbar>
  <ion-toolbar color="primary" class="category-tab">
    <ion-buttons class="ion-justify-content-between">
      <ion-button
        [routerLink]="['/search']"
        queryParamsHandling="preserve"
        [routerAnimation]="routeAnimation"
        fill="outline"
        size="large"
        >{{ 'search.type' | translate }}
      </ion-button>
      <ion-button class="button-active" size="large">{{ 'hebisSearch.type' | translate }}</ion-button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>

<ion-content>
  <div [style.display]="!showDefaultData && !items && !loading ? 'block' : 'none'">
    <ion-label class="centeredMessageContainer"> {{ 'hebisSearch.instruction' | translate }} </ion-label>
  </div>
  <stapps-data-list
    id="data-list"
    [items]="items | async"
    [singleType]="singleTypeResponse"
    (loadmore)="loadMore()"
    [resetToTop]="queryChanged.asObservable()"
    [loading]="loading"
  ></stapps-data-list>
</ion-content>
