import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostListener, ViewChild, } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { Router, RouterLink } from '@angular/router'; import { ControllerClient } from '@app/app/client'; import { ContentRenderComponent } from '@app/app/components/content-render.component'; import { LoadingComponent } from '@app/app/components/loading'; import { DocPageResult } from '@app/common/models'; import { Subject, debounceTime, distinctUntilChanged } from 'rxjs'; @Component({ selector: 'app-search', imports: [ ReactiveFormsModule, FormsModule, LoadingComponent, RouterLink, ContentRenderComponent, ], styles: [ ` :host { max-width: 50%; } .search { position: relative; z-index: 2001; display: flex; a.button { margin-left: 10px; display: none; } } .search.active { .app-search-field { /*width: 350px;*/ } } @media (max-width: 760px) { .search.active { .app-search-field { width: unset; } a.button { display: block; } } :host { position: absolute; left: 15px; top: 26px; } } .overlay { position: fixed; top: 0px; left: 0px; right: 0px; bottom: 0; height: 100vh; z-index: 2000; background-color: rgba(0, 0, 0, 0.6); overflow: hidden; .wrapper { max-height: 100%; .box { padding-top: 80px; background-color: #0e1217; box-shadow: 0 0 10px black; max-width: 650px; } .box-container { position: relative; padding: 10px 35px; max-height: calc(100vh - 100px); } } } `, ], changeDetection: ChangeDetectionStrategy.Eager, template: `
@if (visible) { } `, }) export class SearchComponent { query: string = ''; results?: { pages: DocPageResult[] }; loading = false; visible: boolean = false; modelChanged = new Subject