Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACA-1968] Search input tunings #817

Merged
merged 3 commits into from
Nov 21, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
[title]="'SEARCH.BUTTON.TOOLTIP' | translate">
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
</button>
<mat-form-field class="app-input-form-field">
<mat-form-field class="app-input-form-field" [floatLabel]="'never'">
<input matInput #searchInput
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
[type]="inputType"
id="app-control-input"
[(ngModel)]="searchTerm"
(ngModelChange)="inputChange($event)"
(keyup.enter)="searchSubmit($event)">
<mat-placeholder class="placeholder" *ngIf="!searchTerm.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder>
(keyup.enter)="searchSubmit($event)"
[placeholder]="'SEARCH.INPUT.PLACEHOLDER' | translate">


<div matSuffix class="app-suffix-search-icon-wrapper">
<mat-icon>arrow_drop_down</mat-icon>
<mat-icon *ngIf="searchTerm.length" (click)="clear()" class="app-clear-icon">clear</mat-icon>
<mat-icon *ngIf="!searchTerm.length">arrow_drop_down</mat-icon>
</div>
</mat-form-field>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ $top-margin: 12px;

.mat-form-field-label-wrapper {
cursor: text;
}

// fixes pointer event on FF
&.searchMenuTrigger .mat-form-field-label-wrapper {
pointer-events: auto;
}

Expand All @@ -23,10 +27,6 @@ $top-margin: 12px;
}
}

.mat-focused .placeholder {
color: transparent;
}

.app-search-button.mat-icon-button {
top: -2px;
left: -8px;
Expand All @@ -48,4 +48,9 @@ $top-margin: 12px;
font-size: 24px;
cursor: pointer;
}

.app-clear-icon {
font-size: 18px;
margin: 3px;
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<div class="app-search-container" [matMenuTriggerFor]="searchOptionsMenu">
<div class="app-search-container searchMenuTrigger" [matMenuTriggerFor]="searchOptionsMenu"
(menuOpened)="onMenuOpened()">
<button mat-icon-button
class="app-search-button"
[title]="'SEARCH.BUTTON.TOOLTIP' | translate">
<mat-icon [attr.aria-label]="'SEARCH.BUTTON.ARIA-LABEL' | translate">search</mat-icon>
</button>
<mat-form-field class="app-input-form-field">
<mat-form-field class="app-input-form-field" [floatLabel]="'never'">
<input matInput
[attr.aria-label]="'SEARCH.INPUT.ARIA-LABEL' | translate"
[type]="'text'"
[disabled]="true"
[value]="searchedWord">
<mat-placeholder class="placeholder" *ngIf="!searchedWord.length">{{ 'SEARCH.INPUT.PLACEHOLDER' | translate }}</mat-placeholder>
[value]="searchedWord"
[placeholder]="'SEARCH.INPUT.PLACEHOLDER' | translate">

<div matSuffix class="app-suffix-search-icon-wrapper">
<mat-icon>arrow_drop_down</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ $top-margin: 12px;
}
}
}

.mat-focused label.mat-form-field-label {
display: none;
}
}

.app-search-options-menu {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ export class SearchInputComponent implements OnInit, OnDestroy {
this.onDestroy$.complete();
}

onMenuOpened() {
this.searchInputControl.searchInput.nativeElement.focus();
}

/**
* Called when the user submits the search, e.g. hits enter or clicks submit
*
Expand All @@ -160,6 +164,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {

onSearchChange(searchTerm: string) {
this.has400LibraryError = false;
this.searchedWord = searchTerm;

if (this.hasOneChange) {
this.hasNewChange = true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@

"SEARCH": {
"INPUT": {
"PLACEHOLDER": "Search everywhere",
"PLACEHOLDER": "Search",
"FILES": "Files",
"FOLDERS": "Folders",
"LIBRARIES": "Libraries",
Expand Down