Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Search cosmetics enhancement #322

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/shared/toolbar/toolbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div [class]="'search-form '+(showSearchInput? 'active': '')">
<mat-icon class="search-box-icon show-md" (click)="onTogleSearch()">arrow_back</mat-icon>
<mat-icon class="search-box-icon hide-md" (click)="onSearch(searchBox.value)">search</mat-icon>
<input #searchBox id="search-box" class="search-box" type="search" placeholder="Search apps" (keyup.enter)="onSearch(searchBox.value)" autofocus autocapitalize="none"/>
<input #searchBox id="search-box" class="search-box" type="search" placeholder="Search apps" (keyup.enter)="onSearch(searchBox.value)" (keydown)="onTypeSearch()" autofocus autocapitalize="none"/>
</div>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/app/shared/toolbar/toolbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, ElementRef, ViewChild } from '@angular/core';
import { Output, EventEmitter } from '@angular/core';

@Component({
Expand All @@ -9,6 +9,7 @@ import { Output, EventEmitter } from '@angular/core';
export class ToolbarComponent {

@Output() search: EventEmitter<string> = new EventEmitter<string>();
@ViewChild('searchBox') searchInput: ElementRef;

showSearchInput = false;

Expand All @@ -19,10 +20,15 @@ export class ToolbarComponent {

onTogleSearch() {
this.showSearchInput = !this.showSearchInput;
if (this.showSearchInput) this.searchInput.nativeElement.focus();
}

onCloseSearch() {
this.showSearchInput = false;
}

onTypeSearch() {
this.showSearchInput = true;
}

}