Skip to content

Commit

Permalink
refactor(tabs): rename tab input/config options to be more clear/cons…
Browse files Browse the repository at this point in the history
…istent

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
  • Loading branch information
brandyscarney committed Jul 7, 2016
1 parent 580b8d5 commit 41064bf
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 112 deletions.
4 changes: 2 additions & 2 deletions demos/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ export class ApiDemoPage {
this.config = {
'backButtonIcon': 'ios-arrow-back',
'iconMode': 'ios',
'tabbarPlacement': 'bottom'
'tabsPlacement': 'bottom'
};
} else {
this.config = {
'backButtonIcon': 'md-arrow-back',
'iconMode': 'md',
'tabbarPlacement': 'top'
'tabsPlacement': 'top'
};
}

Expand Down
4 changes: 2 additions & 2 deletions demos/config/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<ion-item>
<ion-label>Tab Placement</ion-label>
<ion-select [(ngModel)]="config.tabbarPlacement">
<ion-select [(ngModel)]="config.tabsPlacement">
<ion-option value="bottom">bottom</ion-option>
<ion-option value="top">top</ion-option>
</ion-select>
Expand All @@ -53,7 +53,7 @@
ionicBootstrap(MyApp, [], {
backButtonIcon: "{{initialConfig.backButtonIcon}}"
iconMode: "{{initialConfig.iconMode}}"
tabbarPlacement: "{{initialConfig.tabbarPlacement}}"
tabsPlacement: "{{initialConfig.tabsPlacement}}"
});</pre>

<div padding>
Expand Down
8 changes: 4 additions & 4 deletions demos/tabs/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@


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


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


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


<!-- No icons -->
<ion-tabs tabbarLayout="icon-hide">
<ion-tabs tabsLayout="icon-hide">
<ion-tab tabTitle="Recents" tabIcon="call" [root]="root"></ion-tab>
<ion-tab tabTitle="Favorites" tabIcon="heart" [root]="root" tabBadge="61" tabBadgeStyle="dark"></ion-tab>
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="root"></ion-tab>
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/structure.scss
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ ion-tabbar.show-tabbar {
opacity: 1;
}

[tabbarPlacement=top] > ion-tabbar {
[tabsPlacement=top] > ion-tabbar {
top: 0;
bottom: auto;
}
Expand Down
20 changes: 10 additions & 10 deletions src/components/content/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class Content extends Ion {
private _headerHeight: number;
private _footerHeight: number;
private _tabbarHeight: number;
private _tabbarPlacement: string;
private _tabsPlacement: string;
private _inputPolling: boolean = false;
private _scroll: ScrollView;
private _scLsn: Function;
Expand Down Expand Up @@ -492,7 +492,7 @@ export class Content extends Ion {
this._paddingLeft = 0;
this._headerHeight = 0;
this._footerHeight = 0;
this._tabbarPlacement = null;
this._tabsPlacement = null;

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

if (this._tabbarPlacement === null) {
if (this._tabsPlacement === null) {
// this is the first tabbar found, remember it's position
this._tabbarPlacement = ele.getAttribute('tabbarplacement');
this._tabsPlacement = ele.getAttribute('tabsplacement');
}
}

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

newVal = this._headerHeight + this._paddingTop;
if (this._tabbarPlacement === 'top') {
if (this._tabsPlacement === 'top') {
newVal += this._tabbarHeight;
}
if (newVal !== this.contentTop) {
Expand All @@ -567,7 +567,7 @@ export class Content extends Ion {
}

newVal = this._footerHeight + this._paddingBottom;
if (this._tabbarPlacement === 'bottom') {
if (this._tabsPlacement === 'bottom') {
newVal += this._tabbarHeight;

if (newVal > 0 && this._footerEle) {
Expand All @@ -582,7 +582,7 @@ export class Content extends Ion {
} else {
// adjust the content with margins
newVal = this._headerHeight;
if (this._tabbarPlacement === 'top') {
if (this._tabsPlacement === 'top') {
newVal += this._tabbarHeight;
}
if (newVal !== this.contentTop) {
Expand All @@ -591,7 +591,7 @@ export class Content extends Ion {
}

newVal = this._footerHeight;
if (this._tabbarPlacement === 'bottom') {
if (this._tabsPlacement === 'bottom') {
newVal += this._tabbarHeight;
}
if (newVal !== this.contentBottom) {
Expand All @@ -605,9 +605,9 @@ export class Content extends Ion {
}


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

} else {
Expand Down
9 changes: 7 additions & 2 deletions src/components/tabs/tab-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ export class TabButton extends Ion {
constructor(config: Config, elementRef: ElementRef) {
super(elementRef);
this.disHover = (config.get('hoverCSS') === false);
this.layout = config.get('tabbarLayout');
this.layout = config.get('tabsLayout');

// TODO deprecated 07-07-2016 beta.11
if (config.get('tabbarLayout') !== undefined) {
this.layout = config.get('tabbarLayout');
}
}

ngOnInit() {
this.tab.btn = this;
this.layout = this.tab.parent.tabbarLayout || this.layout;
this.layout = this.tab.parent.tabsLayout || this.layout;

this.hasTitle = !!this.tab.tabTitle;
this.hasIcon = !!this.tab.tabIcon && this.layout !== 'icon-hide';
Expand Down
12 changes: 6 additions & 6 deletions src/components/tabs/tabs.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ion-tabbar {
background: $tabbar-ios-background;
}

ion-tabs[tabbarPlacement=top] ion-tabbar {
ion-tabs[tabsPlacement=top] ion-tabbar {
border-top: 0;
border-bottom: 1px solid $toolbar-ios-border-color;
}
Expand Down Expand Up @@ -65,8 +65,8 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
}
}

[tabbarLayout=icon-right] .tab-button,
[tabbarLayout=icon-left] .tab-button {
[tabsLayout=icon-right] .tab-button,
[tabsLayout=icon-left] .tab-button {

.tab-button-text {
font-size: 1.4rem;
Expand All @@ -81,7 +81,7 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
}
}

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

Expand All @@ -93,7 +93,7 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
}
}

[tabbarLayout=title-hide] .tab-button,
[tabsLayout=title-hide] .tab-button,
.tab-button.icon-only {
min-height: $tabbar-ios-height - 8;
}
Expand All @@ -104,7 +104,7 @@ ion-tabs[tabbarPlacement=top] ion-tabbar {
border-top-width: $hairlines-width;
}

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

Expand Down
12 changes: 6 additions & 6 deletions src/components/tabs/tabs.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ ion-tabbar {
font-size: $tabbar-md-item-icon-size;
}

[tabbarLayout=icon-bottom] .tab-button {
[tabsLayout=icon-bottom] .tab-button {
padding-top: 8px;
padding-bottom: 8px;
}

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

ion-icon {
min-width: 24px;
}
}

[tabbarLayout=icon-hide] .tab-button,
[tabbarLayout=title-hide] .tab-button,
[tabsLayout=icon-hide] .tab-button,
[tabsLayout=title-hide] .tab-button,
.tab-button.icon-only,
.tab-button.has-title-only {
padding: 6px 10px;
Expand All @@ -91,7 +91,7 @@ tab-highlight {
}
}

[tabbarPlacement=bottom] tab-highlight {
[tabsPlacement=bottom] tab-highlight {
top: 0;
}

Expand Down
16 changes: 8 additions & 8 deletions src/components/tabs/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ tab-highlight {
display: none;
}

[tabbarLayout=icon-bottom] .tab-button {
[tabsLayout=icon-bottom] .tab-button {
.tab-button-icon {
order: 10;
}
}

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

.tab-button-icon {
Expand All @@ -91,7 +91,7 @@ tab-highlight {
}
}

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

.tab-button-icon {
Expand All @@ -103,11 +103,11 @@ tab-highlight {
}
}

[tabbarLayout=icon-hide] .tab-button-icon {
[tabsLayout=icon-hide] .tab-button-icon {
display: none;
}

[tabbarLayout=title-hide] .tab-button-text {
[tabsLayout=title-hide] .tab-button-text {
display: none;
}

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

[tabbarLayout=icon-bottom] .tab-badge,
[tabbarLayout=icon-left] .tab-badge,
[tabbarLayout=icon-right] .tab-badge {
[tabsLayout=icon-bottom] .tab-badge,
[tabsLayout=icon-left] .tab-badge,
[tabsLayout=icon-right] .tab-badge {
right: calc(50% - 50px);
}
Loading

0 comments on commit 41064bf

Please sign in to comment.