Skip to content

Commit 41064bf

Browse files
committed
refactor(tabs): rename tab input/config options to be more clear/consistent
BREAKING CHANGES: Tab input/config options have been renamed. The following options were renamed: - `tabbarHighlight` -> `tabsHighlight` - `tabbarLayout` -> `tabsLayout` - `tabSubPages` -> `tabsHideOnSubPages` - `tabbarPlacement` -> `tabsPlacement` The previous names have been deprecated. They will still work in the current release but will be removed in the future so please update to the new names. references #7143
1 parent 580b8d5 commit 41064bf

File tree

19 files changed

+167
-112
lines changed

19 files changed

+167
-112
lines changed

demos/config/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ export class ApiDemoPage {
9494
this.config = {
9595
'backButtonIcon': 'ios-arrow-back',
9696
'iconMode': 'ios',
97-
'tabbarPlacement': 'bottom'
97+
'tabsPlacement': 'bottom'
9898
};
9999
} else {
100100
this.config = {
101101
'backButtonIcon': 'md-arrow-back',
102102
'iconMode': 'md',
103-
'tabbarPlacement': 'top'
103+
'tabsPlacement': 'top'
104104
};
105105
}
106106

demos/config/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<ion-item>
3333
<ion-label>Tab Placement</ion-label>
34-
<ion-select [(ngModel)]="config.tabbarPlacement">
34+
<ion-select [(ngModel)]="config.tabsPlacement">
3535
<ion-option value="bottom">bottom</ion-option>
3636
<ion-option value="top">top</ion-option>
3737
</ion-select>
@@ -53,7 +53,7 @@
5353
ionicBootstrap(MyApp, [], {
5454
backButtonIcon: "{{initialConfig.backButtonIcon}}"
5555
iconMode: "{{initialConfig.iconMode}}"
56-
tabbarPlacement: "{{initialConfig.tabbarPlacement}}"
56+
tabsPlacement: "{{initialConfig.tabsPlacement}}"
5757
});</pre>
5858

5959
<div padding>

demos/tabs/main.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,31 @@
3333

3434

3535
<!-- Icons below text -->
36-
<ion-tabs tabbarLayout="icon-bottom" selectedIndex="1" danger>
36+
<ion-tabs tabsLayout="icon-bottom" selectedIndex="1" danger>
3737
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root" tabBadge="47" tabBadgeStyle="light"></ion-tab>
3838
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
3939
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
4040
</ion-tabs>
4141

4242

4343
<!-- Icons right of text -->
44-
<ion-tabs tabbarLayout="icon-right" selectedIndex="0" light>
44+
<ion-tabs tabsLayout="icon-right" selectedIndex="0" light>
4545
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
4646
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
4747
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root" tabBadge="4" tabBadgeStyle="secondary"></ion-tab>
4848
</ion-tabs>
4949

5050

5151
<!-- Icons left of text -->
52-
<ion-tabs tabbarLayout="icon-left" dark>
52+
<ion-tabs tabsLayout="icon-left" dark>
5353
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root" tabBadge="1" tabBadgeStyle="danger"></ion-tab>
5454
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root"></ion-tab>
5555
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
5656
</ion-tabs>
5757

5858

5959
<!-- No icons -->
60-
<ion-tabs tabbarLayout="icon-hide">
60+
<ion-tabs tabsLayout="icon-hide">
6161
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
6262
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root" tabBadge="61" tabBadgeStyle="dark"></ion-tab>
6363
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>

src/components/app/structure.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ ion-tabbar.show-tabbar {
176176
opacity: 1;
177177
}
178178

179-
[tabbarPlacement=top] > ion-tabbar {
179+
[tabsPlacement=top] > ion-tabbar {
180180
top: 0;
181181
bottom: auto;
182182
}

src/components/content/content.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class Content extends Ion {
6868
private _headerHeight: number;
6969
private _footerHeight: number;
7070
private _tabbarHeight: number;
71-
private _tabbarPlacement: string;
71+
private _tabsPlacement: string;
7272
private _inputPolling: boolean = false;
7373
private _scroll: ScrollView;
7474
private _scLsn: Function;
@@ -492,7 +492,7 @@ export class Content extends Ion {
492492
this._paddingLeft = 0;
493493
this._headerHeight = 0;
494494
this._footerHeight = 0;
495-
this._tabbarPlacement = null;
495+
this._tabsPlacement = null;
496496

497497
let ele: HTMLElement = this._elementRef.nativeElement;
498498
if (!ele) return;
@@ -530,9 +530,9 @@ export class Content extends Ion {
530530
tabbarEle = <HTMLElement>ele.firstElementChild;
531531
this._tabbarHeight = tabbarEle.clientHeight;
532532

533-
if (this._tabbarPlacement === null) {
533+
if (this._tabsPlacement === null) {
534534
// this is the first tabbar found, remember it's position
535-
this._tabbarPlacement = ele.getAttribute('tabbarplacement');
535+
this._tabsPlacement = ele.getAttribute('tabsplacement');
536536
}
537537
}
538538

@@ -558,7 +558,7 @@ export class Content extends Ion {
558558
// have come from the app's css, is different than the new padding value
559559

560560
newVal = this._headerHeight + this._paddingTop;
561-
if (this._tabbarPlacement === 'top') {
561+
if (this._tabsPlacement === 'top') {
562562
newVal += this._tabbarHeight;
563563
}
564564
if (newVal !== this.contentTop) {
@@ -567,7 +567,7 @@ export class Content extends Ion {
567567
}
568568

569569
newVal = this._footerHeight + this._paddingBottom;
570-
if (this._tabbarPlacement === 'bottom') {
570+
if (this._tabsPlacement === 'bottom') {
571571
newVal += this._tabbarHeight;
572572

573573
if (newVal > 0 && this._footerEle) {
@@ -582,7 +582,7 @@ export class Content extends Ion {
582582
} else {
583583
// adjust the content with margins
584584
newVal = this._headerHeight;
585-
if (this._tabbarPlacement === 'top') {
585+
if (this._tabsPlacement === 'top') {
586586
newVal += this._tabbarHeight;
587587
}
588588
if (newVal !== this.contentTop) {
@@ -591,7 +591,7 @@ export class Content extends Ion {
591591
}
592592

593593
newVal = this._footerHeight;
594-
if (this._tabbarPlacement === 'bottom') {
594+
if (this._tabsPlacement === 'bottom') {
595595
newVal += this._tabbarHeight;
596596
}
597597
if (newVal !== this.contentBottom) {
@@ -605,9 +605,9 @@ export class Content extends Ion {
605605
}
606606

607607

608-
if (this._tabbarPlacement !== null && this._tabs) {
608+
if (this._tabsPlacement !== null && this._tabs) {
609609
// set the position of the tabbar
610-
if (this._tabbarPlacement === 'top') {
610+
if (this._tabsPlacement === 'top') {
611611
this._tabs.setTabbarPosition(this._headerHeight, -1);
612612

613613
} else {

src/components/tabs/tab-button.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,17 @@ export class TabButton extends Ion {
3737
constructor(config: Config, elementRef: ElementRef) {
3838
super(elementRef);
3939
this.disHover = (config.get('hoverCSS') === false);
40-
this.layout = config.get('tabbarLayout');
40+
this.layout = config.get('tabsLayout');
41+
42+
// TODO deprecated 07-07-2016 beta.11
43+
if (config.get('tabbarLayout') !== undefined) {
44+
this.layout = config.get('tabbarLayout');
45+
}
4146
}
4247

4348
ngOnInit() {
4449
this.tab.btn = this;
45-
this.layout = this.tab.parent.tabbarLayout || this.layout;
50+
this.layout = this.tab.parent.tabsLayout || this.layout;
4651

4752
this.hasTitle = !!this.tab.tabTitle;
4853
this.hasIcon = !!this.tab.tabIcon && this.layout !== 'icon-hide';

src/components/tabs/tabs.ios.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ion-tabbar {
2222
background: $tabbar-ios-background;
2323
}
2424

25-
ion-tabs[tabbarPlacement=top] ion-tabbar {
25+
ion-tabs[tabsPlacement=top] ion-tabbar {
2626
border-top: 0;
2727
border-bottom: 1px solid $toolbar-ios-border-color;
2828
}
@@ -65,8 +65,8 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
6565
}
6666
}
6767

68-
[tabbarLayout=icon-right] .tab-button,
69-
[tabbarLayout=icon-left] .tab-button {
68+
[tabsLayout=icon-right] .tab-button,
69+
[tabsLayout=icon-left] .tab-button {
7070

7171
.tab-button-text {
7272
font-size: 1.4rem;
@@ -81,7 +81,7 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
8181
}
8282
}
8383

84-
[tabbarLayout=icon-hide] .tab-button,
84+
[tabsLayout=icon-hide] .tab-button,
8585
.tab-button.has-title-only {
8686
min-height: $tabbar-ios-height - 8;
8787

@@ -93,7 +93,7 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
9393
}
9494
}
9595

96-
[tabbarLayout=title-hide] .tab-button,
96+
[tabsLayout=title-hide] .tab-button,
9797
.tab-button.icon-only {
9898
min-height: $tabbar-ios-height - 8;
9999
}
@@ -104,7 +104,7 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
104104
border-top-width: $hairlines-width;
105105
}
106106

107-
&[tabbarPlacement="top"] ion-tabbar {
107+
&[tabsPlacement="top"] ion-tabbar {
108108
border-bottom-width: $hairlines-width;
109109
}
110110

src/components/tabs/tabs.md.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ ion-tabbar {
5252
font-size: $tabbar-md-item-icon-size;
5353
}
5454

55-
[tabbarLayout=icon-bottom] .tab-button {
55+
[tabsLayout=icon-bottom] .tab-button {
5656
padding-top: 8px;
5757
padding-bottom: 8px;
5858
}
5959

60-
[tabbarLayout=icon-right] .tab-button,
61-
[tabbarLayout=icon-left] .tab-button {
60+
[tabsLayout=icon-right] .tab-button,
61+
[tabsLayout=icon-left] .tab-button {
6262
padding-bottom: 10px;
6363

6464
ion-icon {
6565
min-width: 24px;
6666
}
6767
}
6868

69-
[tabbarLayout=icon-hide] .tab-button,
70-
[tabbarLayout=title-hide] .tab-button,
69+
[tabsLayout=icon-hide] .tab-button,
70+
[tabsLayout=title-hide] .tab-button,
7171
.tab-button.icon-only,
7272
.tab-button.has-title-only {
7373
padding: 6px 10px;
@@ -91,7 +91,7 @@ tab-highlight {
9191
}
9292
}
9393

94-
[tabbarPlacement=bottom] tab-highlight {
94+
[tabsPlacement=bottom] tab-highlight {
9595
top: 0;
9696
}
9797

src/components/tabs/tabs.scss

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ tab-highlight {
7575
display: none;
7676
}
7777

78-
[tabbarLayout=icon-bottom] .tab-button {
78+
[tabsLayout=icon-bottom] .tab-button {
7979
.tab-button-icon {
8080
order: 10;
8181
}
8282
}
8383

84-
[tabbarLayout=icon-left] .tab-button {
84+
[tabsLayout=icon-left] .tab-button {
8585
flex-direction: row;
8686

8787
.tab-button-icon {
@@ -91,7 +91,7 @@ tab-highlight {
9191
}
9292
}
9393

94-
[tabbarLayout=icon-right] .tab-button {
94+
[tabsLayout=icon-right] .tab-button {
9595
flex-direction: row;
9696

9797
.tab-button-icon {
@@ -103,11 +103,11 @@ tab-highlight {
103103
}
104104
}
105105

106-
[tabbarLayout=icon-hide] .tab-button-icon {
106+
[tabsLayout=icon-hide] .tab-button-icon {
107107
display: none;
108108
}
109109

110-
[tabbarLayout=title-hide] .tab-button-text {
110+
[tabsLayout=title-hide] .tab-button-text {
111111
display: none;
112112
}
113113

@@ -132,8 +132,8 @@ tab-highlight {
132132
right: calc(50% - 30px);
133133
}
134134

135-
[tabbarLayout=icon-bottom] .tab-badge,
136-
[tabbarLayout=icon-left] .tab-badge,
137-
[tabbarLayout=icon-right] .tab-badge {
135+
[tabsLayout=icon-bottom] .tab-badge,
136+
[tabsLayout=icon-left] .tab-badge,
137+
[tabsLayout=icon-right] .tab-badge {
138138
right: calc(50% - 50px);
139139
}

0 commit comments

Comments
 (0)