From 0105a4ee47706d9b3aa8f22d0a75585a498731ec Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 28 Mar 2018 10:12:04 -0500 Subject: [PATCH] refactor(tab): rename tab properties --- core/src/components.d.ts | 60 +++++----- .../components/app/test/cordova/index.html | 6 +- .../components/router/test/basic/index.html | 16 +-- .../components/router/test/preview/index.html | 19 +-- core/src/components/tab-button/tab-button.tsx | 12 +- core/src/components/tab/readme.md | 112 +++++++++--------- core/src/components/tab/tab.tsx | 10 +- .../src/components/tabs/test/basic/index.html | 10 +- core/src/components/tabs/test/nav/index.html | 6 +- .../components/tabs/test/preview/index.html | 10 +- .../components/tabs/test/scroll/index.html | 30 ++--- .../tabs/test/translucent/index.html | 10 +- .../components/tabs/test/vanilla/index.html | 4 +- 13 files changed, 148 insertions(+), 157 deletions(-) diff --git a/core/src/components.d.ts b/core/src/components.d.ts index 4df7052b6a..52acb4396c 100644 --- a/core/src/components.d.ts +++ b/core/src/components.d.ts @@ -5756,14 +5756,6 @@ declare global { declare global { interface HTMLIonTabElement extends HTMLStencilElement { 'active': boolean; - /** - * The badge for the tab. - */ - 'badge': string; - /** - * The badge color for the tab button. - */ - 'badgeStyle': string; 'btnId': string; /** * The component to display inside of the tab. @@ -5779,10 +5771,6 @@ declare global { * The URL which will be used as the `href` within this tab's `` anchor. */ 'href': string; - /** - * The icon for the tab. - */ - 'icon': string; /** * The name of the tab. */ @@ -5797,13 +5785,25 @@ declare global { */ 'show': boolean; /** - * If true, hide the tabs on child pages. + * The badge for the tab. */ - 'tabsHideOnSubPages': boolean; + 'tabBadge': string; + /** + * The badge color for the tab button. + */ + 'tabBadgeStyle': string; + /** + * The icon for the tab. + */ + 'tabIcon': string; /** * The title of the tab. */ - 'title': string; + 'tabTitle': string; + /** + * If true, hide the tabs on child pages. + */ + 'tabsHideOnSubPages': boolean; } var HTMLIonTabElement: { prototype: HTMLIonTabElement; @@ -5823,14 +5823,6 @@ declare global { namespace JSXElements { export interface IonTabAttributes extends HTMLAttributes { 'active'?: boolean; - /** - * The badge for the tab. - */ - 'badge'?: string; - /** - * The badge color for the tab button. - */ - 'badgeStyle'?: string; 'btnId'?: string; /** * The component to display inside of the tab. @@ -5845,10 +5837,6 @@ declare global { * The URL which will be used as the `href` within this tab's `` anchor. */ 'href'?: string; - /** - * The icon for the tab. - */ - 'icon'?: string; /** * The name of the tab. */ @@ -5866,13 +5854,25 @@ declare global { */ 'show'?: boolean; /** - * If true, hide the tabs on child pages. + * The badge for the tab. */ - 'tabsHideOnSubPages'?: boolean; + 'tabBadge'?: string; + /** + * The badge color for the tab button. + */ + 'tabBadgeStyle'?: string; + /** + * The icon for the tab. + */ + 'tabIcon'?: string; /** * The title of the tab. */ - 'title'?: string; + 'tabTitle'?: string; + /** + * If true, hide the tabs on child pages. + */ + 'tabsHideOnSubPages'?: boolean; } } } diff --git a/core/src/components/app/test/cordova/index.html b/core/src/components/app/test/cordova/index.html index 939b3a3729..8ec66a750c 100644 --- a/core/src/components/app/test/cordova/index.html +++ b/core/src/components/app/test/cordova/index.html @@ -208,15 +208,15 @@ class TabsPage extends HTMLElement { async connectedCallback() { this.innerHTML = ` - + - + - + diff --git a/core/src/components/router/test/basic/index.html b/core/src/components/router/test/basic/index.html index 08a894e74a..78c6c31ddb 100644 --- a/core/src/components/router/test/basic/index.html +++ b/core/src/components/router/test/basic/index.html @@ -104,21 +104,21 @@ this.innerHTML = ` + tab-title="Plain List" + tab-icon="star"> + tab-title="Schedule" + tab-icon="globe"> inline tab 4 diff --git a/core/src/components/router/test/preview/index.html b/core/src/components/router/test/preview/index.html index 1210cebb8a..d7bea15a01 100644 --- a/core/src/components/router/test/preview/index.html +++ b/core/src/components/router/test/preview/index.html @@ -121,25 +121,16 @@ - + - + - + - + inline tab 4 + diff --git a/core/src/components/tab-button/tab-button.tsx b/core/src/components/tab-button/tab-button.tsx index da0defb070..e4d3e3fdf2 100644 --- a/core/src/components/tab-button/tab-button.tsx +++ b/core/src/components/tab-button/tab-button.tsx @@ -51,11 +51,11 @@ export class TabButton { hostData() { const selected = this.selected; const tab = this.tab; - const hasTitle = !!tab.title; - const hasIcon = !!tab.icon; + const hasTitle = !!tab.tabTitle; + const hasIcon = !!tab.tabIcon; const hasTitleOnly = (hasTitle && !hasIcon); const hasIconOnly = (hasIcon && !hasTitle); - const hasBadge = !!tab.badge; + const hasBadge = !!tab.tabBadge; return { 'role': 'tab', 'id': tab.btnId, @@ -84,9 +84,9 @@ export class TabButton { class='tab-cover' onKeyUp={this.onKeyUp.bind(this)} onBlur={this.onBlur.bind(this)}> - { tab.icon && } - { tab.title && {tab.title} } - { tab.badge && {tab.badge} } + { tab.tabIcon && } + { tab.tabTitle && {tab.tabTitle} } + { tab.tabBadge && {tab.tabBadge} } { this.mode === 'md' && } ]; diff --git a/core/src/components/tab/readme.md b/core/src/components/tab/readme.md index 80f23ff84d..437258d7ee 100644 --- a/core/src/components/tab/readme.md +++ b/core/src/components/tab/readme.md @@ -55,20 +55,6 @@ export class Tabs { boolean -#### badge - -string - -The badge for the tab. - - -#### badgeStyle - -string - -The badge color for the tab button. - - #### btnId string @@ -100,13 +86,6 @@ string The URL which will be used as the `href` within this tab's `` anchor. -#### icon - -string - -The icon for the tab. - - #### name string @@ -128,6 +107,34 @@ boolean If true, the tab button is visible within the tabbar. Defaults to `true`. +#### tabBadge + +string + +The badge for the tab. + + +#### tabBadgeStyle + +string + +The badge color for the tab button. + + +#### tabIcon + +string + +The icon for the tab. + + +#### tabTitle + +string + +The title of the tab. + + #### tabsHideOnSubPages boolean @@ -135,13 +142,6 @@ boolean If true, hide the tabs on child pages. -#### title - -string - -The title of the tab. - - ## Attributes #### active @@ -149,20 +149,6 @@ The title of the tab. boolean -#### badge - -string - -The badge for the tab. - - -#### badge-style - -string - -The badge color for the tab button. - - #### btn-id string @@ -194,13 +180,6 @@ string The URL which will be used as the `href` within this tab's `` anchor. -#### icon - -string - -The icon for the tab. - - #### name string @@ -222,6 +201,34 @@ boolean If true, the tab button is visible within the tabbar. Defaults to `true`. +#### tab-badge + +string + +The badge for the tab. + + +#### tab-badge-style + +string + +The badge color for the tab button. + + +#### tab-icon + +string + +The icon for the tab. + + +#### tab-title + +string + +The title of the tab. + + #### tabs-hide-on-sub-pages boolean @@ -229,13 +236,6 @@ boolean If true, hide the tabs on child pages. -#### title - -string - -The title of the tab. - - ## Events #### ionSelect diff --git a/core/src/components/tab/tab.tsx b/core/src/components/tab/tab.tsx index 8c940a9f82..5d07c63066 100644 --- a/core/src/components/tab/tab.tsx +++ b/core/src/components/tab/tab.tsx @@ -19,7 +19,7 @@ export class Tab { /** * The title of the tab. */ - @Prop() title: string; + @Prop() tabTitle: string; /** * The URL which will be used as the `href` within this tab's `` anchor. @@ -29,17 +29,17 @@ export class Tab { /** * The icon for the tab. */ - @Prop() icon: string; + @Prop() tabIcon: string; /** * The badge for the tab. */ - @Prop() badge: string; + @Prop() tabBadge: string; /** * The badge color for the tab button. */ - @Prop() badgeStyle = 'default'; + @Prop() tabBadgeStyle = 'default'; /** * The component to display inside of the tab. @@ -87,7 +87,7 @@ export class Tab { componentWillLoad() { if (Build.isDev) { if (this.component && this.el.childElementCount > 0) { - console.error('You can not use a lazy-loaded component in a tab and inlineed content at the same time.' + + console.error('You can not use a lazy-loaded component in a tab and inlined content at the same time.' + `- Remove the component attribute in: ` + ` or` + `- Remove the embeded content inside the ion-tab: `); diff --git a/core/src/components/tabs/test/basic/index.html b/core/src/components/tabs/test/basic/index.html index aac43fef91..eccb1c669e 100644 --- a/core/src/components/tabs/test/basic/index.html +++ b/core/src/components/tabs/test/basic/index.html @@ -10,7 +10,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -50,8 +50,8 @@ diff --git a/core/src/components/tabs/test/nav/index.html b/core/src/components/tabs/test/nav/index.html index c99a2401c5..5d1f4ea93c 100644 --- a/core/src/components/tabs/test/nav/index.html +++ b/core/src/components/tabs/test/nav/index.html @@ -250,15 +250,15 @@ - + - + - + diff --git a/core/src/components/tabs/test/preview/index.html b/core/src/components/tabs/test/preview/index.html index af2923ad54..ebd8a7baec 100644 --- a/core/src/components/tabs/test/preview/index.html +++ b/core/src/components/tabs/test/preview/index.html @@ -10,7 +10,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -50,8 +50,8 @@ diff --git a/core/src/components/tabs/test/scroll/index.html b/core/src/components/tabs/test/scroll/index.html index 1124712708..ffb8445e9a 100644 --- a/core/src/components/tabs/test/scroll/index.html +++ b/core/src/components/tabs/test/scroll/index.html @@ -11,21 +11,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/core/src/components/tabs/test/translucent/index.html b/core/src/components/tabs/test/translucent/index.html index 8953ce37bc..8ce9b6a5c3 100644 --- a/core/src/components/tabs/test/translucent/index.html +++ b/core/src/components/tabs/test/translucent/index.html @@ -13,25 +13,25 @@ - + - + - + - + - + diff --git a/core/src/components/tabs/test/vanilla/index.html b/core/src/components/tabs/test/vanilla/index.html index b5192a3e8d..5d00bd9829 100644 --- a/core/src/components/tabs/test/vanilla/index.html +++ b/core/src/components/tabs/test/vanilla/index.html @@ -11,11 +11,11 @@ - +
Div One
- +
Div Two