Skip to content

Commit

Permalink
fix(item): add a default size for items in buttons to use the content…
Browse files Browse the repository at this point in the history
… button sizes

fixes #5580
  • Loading branch information
brandyscarney committed Mar 4, 2016
1 parent f6af807 commit 7b14a29
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ionic/components/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {Toolbar} from '../toolbar/toolbar';
})
export class Button {
private _role: string = 'button'; // bar-button/item-button
private _size: string = null; // large/small
private _size: string = null; // large/small/default
private _style: string = 'default'; // outline/clear/solid
private _shape: string = null; // round/fab
private _display: string = null; // block/full
Expand Down Expand Up @@ -242,7 +242,7 @@ export class Button {

}

const BUTTON_SIZE_ATTRS = ['large', 'small'];
const BUTTON_SIZE_ATTRS = ['large', 'small', 'default'];
const BUTTON_STYLE_ATTRS = ['clear', 'outline', 'solid'];
const BUTTON_SHAPE_ATTRS = ['round', 'fab'];
const BUTTON_DISPLAY_ATTRS = ['block', 'full'];
Expand Down
4 changes: 3 additions & 1 deletion ionic/components/item/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export class Item {
@ContentChildren(Button)
private set _buttons(buttons) {
buttons.toArray().forEach(button => {
if (!button.isItem) {
// Don't add the item-button class if the user specifies
// a different size button
if (!button.isItem && !button._size) {
button.addClass('item-button');
}
});
Expand Down
14 changes: 7 additions & 7 deletions ionic/components/item/test/buttons/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,29 @@
</ion-item>

<ion-item>
<button clear item-left (click)="testClick($event)">
<button clear item-left default (click)="testClick($event)">
<ion-icon name="navigate"></ion-icon>
</button>
icon only buttons
<button clear item-right (click)="testClick($event)">
icon only buttons default
<button clear item-right default (click)="testClick($event)">
<ion-icon name="navigate"></ion-icon>
</button>
</ion-item>

<ion-item>
ion-item right icon/text button
<button item-right (click)="testClick($event)">
ion-item right icon/text button large
<button item-right large (click)="testClick($event)">
<ion-icon name="refresh"></ion-icon>
Refresh
</button>
</ion-item>

<ion-item>
<button clear item-left (click)="testClick($event)">
<button clear item-left small (click)="testClick($event)">
<ion-icon name="settings"></ion-icon>
Settings
</button>
ion-item left clear button
ion-item left clear button small
</ion-item>

<ion-item>
Expand Down

0 comments on commit 7b14a29

Please sign in to comment.