ModeComponent

This commit is contained in:
Adam Bradley
2015-06-09 16:08:13 -05:00
parent dd208207a7
commit b3e0e3f048
3 changed files with 37 additions and 27 deletions

View File

@ -8,6 +8,7 @@ import {bind} from 'angular2/di';
import {ViewController} from '../view/view-controller'; import {ViewController} from '../view/view-controller';
import {Nav} from './nav'; import {Nav} from './nav';
import {SwipeHandle} from './swipe-handle'; import {SwipeHandle} from './swipe-handle';
import {ModeComponent} from '../../config/component';
export class PaneController { export class PaneController {
@ -92,11 +93,9 @@ export class PaneController {
} }
@Component({ @ModeComponent({
selector:'ion-pane', selector:'ion-pane',
hostAttributes: { classId: 'nav'
'class': 'nav nav-ios'
}
}) })
@View({ @View({
template: ` template: `

View File

@ -14,14 +14,16 @@ import {ViewItem} from '../view/view-item';
import {TabButton} from './tab-button'; import {TabButton} from './tab-button';
import {Icon} from '../icon/icon'; import {Icon} from '../icon/icon';
import {IonicComponent} from '../../config/component'; import {IonicComponent} from '../../config/component';
import {ModeComponent} from '../../config/component';
@Component({ @ModeComponent({
selector: 'ion-tabs', selector: 'ion-tabs',
properties: [ properties: [
'tabBarPlacement', 'tabBarPlacement',
'tabBarIcons' 'tabBarIcons'
] ],
classId: 'tabs'
}) })
@View({ @View({
template: ` template: `
@ -51,9 +53,6 @@ export class Tabs extends ViewController {
) { ) {
super(viewController, compiler, elementRef, loader, injector); super(viewController, compiler, elementRef, loader, injector);
this.item = item; this.item = item;
this.domElement = elementRef.domElement;
this.config = Tabs.config.invoke(this);
} }
addTab(tabItem) { addTab(tabItem) {
@ -104,21 +103,21 @@ export class Tabs extends ViewController {
} }
} }
new IonicComponent(Tabs, { // new IonicComponent(Tabs, {
properties: { // properties: {
tabBarPlacement: { // tabBarPlacement: {
defaults: { // defaults: {
ios: 'bottom', // ios: 'bottom',
android: 'top', // android: 'top',
core: 'bottom' // core: 'bottom'
} // }
}, // },
tabBarIcons: { // tabBarIcons: {
defaults: { // defaults: {
ios: 'top', // ios: 'top',
android: 'top', // android: 'top',
core: 'top' // core: 'top'
} // }
} // }
} // }
}); // });

View File

@ -1,3 +1,5 @@
import {Component} from 'angular2/src/core/annotations_impl/annotations';
import * as util from 'ionic/util' import * as util from 'ionic/util'
import {dom} from 'ionic/util' import {dom} from 'ionic/util'
import {Platform} from 'ionic/platform/platform' import {Platform} from 'ionic/platform/platform'
@ -8,6 +10,16 @@ let platformMode = Platform.getMode();
// BackButton.config.bind.icon.value = 'ion-chevron-right' // BackButton.config.bind.icon.value = 'ion-chevron-right'
// BackButton.config._computeDefaultValue(BackButton.config.bind.icon) // BackButton.config._computeDefaultValue(BackButton.config.bind.icon)
export class ModeComponent extends Component {
constructor(config) {
config.hostAttributes = config.hostAttributes || {};
let className = (config.hostAttributes['class'] || '');
let id = config.classId || config.selector.replace('ion-', '');
config.hostAttributes['class'] = (className + ' ' + id + ' ' + id + '-' + platformMode).trim();
super(config);
}
}
export class IonicComponent { export class IonicComponent {
constructor(ComponentClass, { constructor(ComponentClass, {
properties, properties,