From 7b14a29ea78fe480c065c170d351adad8fb42e8e Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Fri, 4 Mar 2016 16:16:22 -0500 Subject: [PATCH] fix(item): add a default size for items in buttons to use the content button sizes fixes #5580 --- ionic/components/button/button.ts | 4 ++-- ionic/components/item/item.ts | 4 +++- ionic/components/item/test/buttons/main.html | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ionic/components/button/button.ts b/ionic/components/button/button.ts index 02cad24786..df9f987c19 100644 --- a/ionic/components/button/button.ts +++ b/ionic/components/button/button.ts @@ -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 @@ -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']; diff --git a/ionic/components/item/item.ts b/ionic/components/item/item.ts index 0afe2ab374..2071aeed27 100644 --- a/ionic/components/item/item.ts +++ b/ionic/components/item/item.ts @@ -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'); } }); diff --git a/ionic/components/item/test/buttons/main.html b/ionic/components/item/test/buttons/main.html index 3d8e56f27b..f6a08a6156 100644 --- a/ionic/components/item/test/buttons/main.html +++ b/ionic/components/item/test/buttons/main.html @@ -49,29 +49,29 @@ - - icon only buttons - - ion-item right icon/text button - - - ion-item left clear button + ion-item left clear button small