[ACA-1968] style search input for smaller screens (#833)

* [ACA-1968] more friendly small screen style

* [ACA-1968] media queries

* [ACA-1968] fix margin

* [ACA-1968] small fixes

* [ACA-1968] cleanup unused code
This commit is contained in:
Suzana Dirla
2018-11-29 12:05:33 +02:00
committed by Denys Vuika
parent 6c821d0fba
commit 462cc09146
6 changed files with 76 additions and 21 deletions

View File

@@ -22,7 +22,7 @@
} }
.current-user__full-name { .current-user__full-name {
width: 100px; max-width: 100px;
text-align: right; text-align: right;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

@@ -6,11 +6,11 @@
[title]="appName$ | async" [title]="appName$ | async"
(clicked)="toggleClicked.emit($event)"> (clicked)="toggleClicked.emit($event)">
<div class="adf-toolbar--spacer"></div> <div class="adf-toolbar--spacer adf-toolbar-divider"></div>
<ng-container *ngIf="!isSmallScreen"> <aca-search-input></aca-search-input>
<aca-search-input></aca-search-input>
</ng-container> <div class="adf-toolbar-divider"></div>
<aca-current-user></aca-current-user> <aca-current-user></aca-current-user>

View File

@@ -37,7 +37,6 @@ import {
selectAppName, selectAppName,
selectLogoPath selectLogoPath
} from '../../store/selectors/app.selectors'; } from '../../store/selectors/app.selectors';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { ContentActionRef } from '@alfresco/adf-extensions'; import { ContentActionRef } from '@alfresco/adf-extensions';
import { AppExtensionService } from '../../extensions/extension.service'; import { AppExtensionService } from '../../extensions/extension.service';
import { AppStore } from '../../store/states'; import { AppStore } from '../../store/states';
@@ -56,12 +55,10 @@ export class AppHeaderComponent implements OnInit {
headerColor$: Observable<string>; headerColor$: Observable<string>;
logo$: Observable<string>; logo$: Observable<string>;
isSmallScreen = false;
actions: Array<ContentActionRef> = []; actions: Array<ContentActionRef> = [];
constructor( constructor(
store: Store<AppStore>, store: Store<AppStore>,
private breakpointObserver: BreakpointObserver,
private appExtensions: AppExtensionService private appExtensions: AppExtensionService
) { ) {
this.headerColor$ = store.select(selectHeaderColor); this.headerColor$ = store.select(selectHeaderColor);
@@ -71,12 +68,6 @@ export class AppHeaderComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.actions = this.appExtensions.getHeaderActions(); this.actions = this.appExtensions.getHeaderActions();
this.breakpointObserver
.observe([Breakpoints.HandsetPortrait, Breakpoints.HandsetLandscape])
.subscribe(result => {
this.isSmallScreen = result.matches;
});
} }
trackByActionId(index: number, action: ContentActionRef) { trackByActionId(index: number, action: ContentActionRef) {

View File

@@ -14,8 +14,6 @@
(ngModelChange)="inputChange($event)" (ngModelChange)="inputChange($event)"
(keyup.enter)="searchSubmit($event)" (keyup.enter)="searchSubmit($event)"
[placeholder]="'SEARCH.INPUT.PLACEHOLDER' | translate"> [placeholder]="'SEARCH.INPUT.PLACEHOLDER' | translate">
<div matSuffix class="app-suffix-search-icon-wrapper"> <div matSuffix class="app-suffix-search-icon-wrapper">
<mat-icon *ngIf="searchTerm.length" (click)="clear()" class="app-clear-icon">clear</mat-icon> <mat-icon *ngIf="searchTerm.length" (click)="clear()" class="app-clear-icon">clear</mat-icon>
</div> </div>

View File

@@ -4,6 +4,8 @@ $top-margin: 12px;
margin-top: -$top-margin; margin-top: -$top-margin;
padding-top: 2px; padding-top: 2px;
font-size: 16px; font-size: 16px;
padding-left: 15px;
box-sizing: border-box;
.mat-form-field-underline { .mat-form-field-underline {
display: none; display: none;
@@ -20,7 +22,7 @@ $top-margin: 12px;
.app-input-form-field { .app-input-form-field {
letter-spacing: -0.7px; letter-spacing: -0.7px;
width: 90%; width: calc(100% - 56px);
.mat-input-element { .mat-input-element {
letter-spacing: -0.7px; letter-spacing: -0.7px;
@@ -30,7 +32,6 @@ $top-margin: 12px;
.app-search-button.mat-icon-button { .app-search-button.mat-icon-button {
top: -2px; top: -2px;
left: -8px; left: -8px;
margin-left: 15px;
.mat-icon { .mat-icon {
font-size: 24px; font-size: 24px;
@@ -41,7 +42,7 @@ $top-margin: 12px;
.app-suffix-search-icon-wrapper { .app-suffix-search-icon-wrapper {
height: 6px; height: 6px;
margin: 14px 13px; margin: 14px 1px;
float: left; float: left;
.mat-icon { .mat-icon {

View File

@@ -45,14 +45,16 @@ $top-margin: 12px;
} }
.aca-search-input { .aca-search-input {
margin-right: 7px; width: 100%;
max-width: $search-width;
background-color: $search-background; background-color: $search-background;
border-radius: $search-border-radius; border-radius: $search-border-radius;
height: $search-height; height: $search-height;
} }
.app-search-container { .app-search-container {
width: $search-width; width: 100%;
max-width: $search-width;
height: $search-height + $top-margin; height: $search-height + $top-margin;
} }
@@ -89,8 +91,14 @@ $top-margin: 12px;
.mat-checkbox-label { .mat-checkbox-label {
padding: 0 0 0 11px; padding: 0 0 0 11px;
overflow: hidden;
text-overflow: ellipsis;
} }
} }
.mat-checkbox-layout {
max-width: 155px;
}
} }
.app-search-hint { .app-search-hint {
@@ -98,3 +106,60 @@ $top-margin: 12px;
font-size: 12px; font-size: 12px;
padding-left: 17px; padding-left: 17px;
} }
@media screen and ($mat-small) {
$search-width-small: 400px;
.aca-search-input {
max-width: $search-width-small;
}
.app-search-container {
max-width: $search-width-small;
}
.app-search-options-menu {
&.mat-menu-panel {
width: $search-width-small;
}
}
#search-options {
padding-left: 20px;
mat-checkbox {
padding: 3px 20px 3px 0;
.mat-checkbox-label {
padding: 0;
}
}
.mat-checkbox-layout {
max-width: 105px;
}
}
}
@media screen and ($mat-xsmall) {
$search-width-xsmall: 220px;
.aca-search-input {
max-width: $search-width-xsmall;
}
.app-search-container {
max-width: $search-width-xsmall;
}
.app-search-options-menu {
&.mat-menu-panel {
width: $search-width-xsmall;
margin-top: 9px;
}
}
#search-options .mat-checkbox-layout {
max-width: 180px;
}
}