refactor(searchbar): add class to searchbar when hideCancel is passed

only hide the search icon when hideCancel isn’t passed
This commit is contained in:
Brandy Carney
2016-02-25 18:36:12 -05:00
parent 21d4cef543
commit a0f0004012
2 changed files with 10 additions and 2 deletions

View File

@@ -119,7 +119,7 @@ ion-searchbar {
// Searchbar Focused
// -----------------------------------------
.searchbar-focused {
.searchbar-focused:not(.searchbar-hide-cancel) {
.searchbar-search-icon {
display: none;
}

View File

@@ -39,7 +39,12 @@ export class SearchbarInput {
*
* @usage
* ```html
* <ion-searchbar [(ngModel)]="defaultSearch" (input)="triggerInput($event)" (cancel)="onCancelSearchbar($event)" (clear)="onClearSearchbar($event)" [hideCancelButton]="false"></ion-searchbar>
* <ion-searchbar
* [(ngModel)]="myInput"
* [hideCancelButton]="shouldHideCancel"
* (input)="onInput($event)"
* (cancel)="onCancel($event)">
* </ion-searchbar>
* ```
*
* @demo /docs/v2/demos/searchbar/
@@ -47,6 +52,9 @@ export class SearchbarInput {
*/
@Component({
selector: 'ion-searchbar',
host: {
'[class.searchbar-hide-cancel]': 'hideCancelButton'
},
template:
'<div class="searchbar-input-container">' +
'<button (click)="cancelSearchbar()" (mousedown)="cancelSearchbar()" [hidden]="hideCancelButton" clear dark class="searchbar-md-cancel">' +