Skip to content

Commit 7b14a29

Browse files
committed
fix(item): add a default size for items in buttons to use the content button sizes
fixes #5580
1 parent f6af807 commit 7b14a29

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

ionic/components/button/button.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {Toolbar} from '../toolbar/toolbar';
4141
})
4242
export class Button {
4343
private _role: string = 'button'; // bar-button/item-button
44-
private _size: string = null; // large/small
44+
private _size: string = null; // large/small/default
4545
private _style: string = 'default'; // outline/clear/solid
4646
private _shape: string = null; // round/fab
4747
private _display: string = null; // block/full
@@ -242,7 +242,7 @@ export class Button {
242242

243243
}
244244

245-
const BUTTON_SIZE_ATTRS = ['large', 'small'];
245+
const BUTTON_SIZE_ATTRS = ['large', 'small', 'default'];
246246
const BUTTON_STYLE_ATTRS = ['clear', 'outline', 'solid'];
247247
const BUTTON_SHAPE_ATTRS = ['round', 'fab'];
248248
const BUTTON_DISPLAY_ATTRS = ['block', 'full'];

ionic/components/item/item.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ export class Item {
143143
@ContentChildren(Button)
144144
private set _buttons(buttons) {
145145
buttons.toArray().forEach(button => {
146-
if (!button.isItem) {
146+
// Don't add the item-button class if the user specifies
147+
// a different size button
148+
if (!button.isItem && !button._size) {
147149
button.addClass('item-button');
148150
}
149151
});

ionic/components/item/test/buttons/main.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,29 @@
4949
</ion-item>
5050

5151
<ion-item>
52-
<button clear item-left (click)="testClick($event)">
52+
<button clear item-left default (click)="testClick($event)">
5353
<ion-icon name="navigate"></ion-icon>
5454
</button>
55-
icon only buttons
56-
<button clear item-right (click)="testClick($event)">
55+
icon only buttons default
56+
<button clear item-right default (click)="testClick($event)">
5757
<ion-icon name="navigate"></ion-icon>
5858
</button>
5959
</ion-item>
6060

6161
<ion-item>
62-
ion-item right icon/text button
63-
<button item-right (click)="testClick($event)">
62+
ion-item right icon/text button large
63+
<button item-right large (click)="testClick($event)">
6464
<ion-icon name="refresh"></ion-icon>
6565
Refresh
6666
</button>
6767
</ion-item>
6868

6969
<ion-item>
70-
<button clear item-left (click)="testClick($event)">
70+
<button clear item-left small (click)="testClick($event)">
7171
<ion-icon name="settings"></ion-icon>
7272
Settings
7373
</button>
74-
ion-item left clear button
74+
ion-item left clear button small
7575
</ion-item>
7676

7777
<ion-item>

0 commit comments

Comments
 (0)