Skip to content

Commit

Permalink
refactor(searchbar): add class to searchbar when hideCancel is passed
Browse files Browse the repository at this point in the history
only hide the search icon when hideCancel isn’t passed
  • Loading branch information
brandyscarney committed Feb 25, 2016
1 parent 21d4cef commit a0f0004
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ionic/components/searchbar/searchbar.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ion-searchbar {
// Searchbar Focused
// -----------------------------------------

.searchbar-focused {
.searchbar-focused:not(.searchbar-hide-cancel) {
.searchbar-search-icon {
display: none;
}
Expand Down
10 changes: 9 additions & 1 deletion ionic/components/searchbar/searchbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ 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/
* @see {@link /docs/v2/components#searchbar Searchbar Component Docs}
*/
@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">' +
Expand Down

0 comments on commit a0f0004

Please sign in to comment.