feat(tabs): scrollable tabs

This commit is contained in:
Ross Gerbasi
2017-12-18 21:01:09 -06:00
committed by Adam Bradley
parent a881eb1b82
commit ec2bf8bfbe
15 changed files with 264 additions and 152 deletions

View File

@@ -31,6 +31,12 @@ any
## Events
#### ionTabButtonDidLoad
#### ionTabButtonDidUnload
#### ionTabbarClick

View File

@@ -1,4 +1,4 @@
import { Component, Event, EventEmitter, Listen, Prop } from '@stencil/core';
import {Component, Element, Event, EventEmitter, Listen, Prop} from '@stencil/core';
@Component({
@@ -6,10 +6,22 @@ import { Component, Event, EventEmitter, Listen, Prop } from '@stencil/core';
})
export class TabButton {
@Element() el: HTMLElement;
@Prop() selected = false;
@Prop() tab: HTMLIonTabElement;
@Event() ionTabbarClick: EventEmitter;
@Event() ionTabButtonDidLoad: EventEmitter;
@Event() ionTabButtonDidUnload: EventEmitter;
componentDidLoad() {
this.ionTabButtonDidLoad.emit({ button: this });
}
componentDidUnload() {
this.ionTabButtonDidUnload.emit({ button: this });
}
@Listen('click')
protected onClick(ev: UIEvent) {
@@ -21,7 +33,7 @@ export class TabButton {
const selected = this.selected;
const tab = this.tab;
const hasTitle = !!tab.title;
const hasIcon = !! tab.icon;
const hasIcon = !!tab.icon;
const hasTitleOnly = (hasTitle && !hasIcon);
const hasIconOnly = (hasIcon && !hasTitle);
const hasBadge = !!tab.badge;