feat(badge): update badge to ionic core

This commit is contained in:
Adam Bradley
2017-04-18 15:33:46 -05:00
parent c833706045
commit 5ddfbaaf39
12 changed files with 52 additions and 55 deletions

View File

@@ -449,3 +449,11 @@ ion-footer {
}
}
}
// Core Components
// --------------------------------------------------
ion-badge {
visibility: hidden;
}

View File

@@ -1,4 +1,6 @@
@import "../../themes/ionic.globals.ios";
@import "./badge";
// iOS Badge
// --------------------------------------------------

View File

@@ -1,4 +1,6 @@
@import "../../themes/ionic.globals.md";
@import "./badge";
// Material Design Badge
// --------------------------------------------------

View File

@@ -1,20 +0,0 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { Badge } from './badge';
/** @hidden */
@NgModule({
declarations: [
Badge
],
exports: [
Badge
]
})
export class BadgeModule {
public static forRoot(): ModuleWithProviders {
return {
ngModule: BadgeModule, providers: []
};
}
}

View File

@@ -1,5 +1,6 @@
@import "../../themes/ionic.globals";
// Badge
// --------------------------------------------------
@@ -10,9 +11,14 @@ $badge-font-size: 1.3rem !default;
$badge-font-weight: bold !default;
ion-badge {
ion-badge,
:host {
display: inline-block;
visibility: inherit !important;
contain: layout content;
}
.badge {
padding: 3px 8px;
min-width: 10px;
@@ -26,6 +32,7 @@ ion-badge {
vertical-align: baseline;
}
ion-badge:empty {
ion-badge:empty,
:host(:empty) {
display: none;
}

View File

@@ -1,23 +1,12 @@
import { Directive, ElementRef, Renderer } from '@angular/core';
import { Config } from '../../config/config';
import { Ion } from '../ion';
import { Component } from '../../util/decorators';
/**
* @name Badge
* @module ionic
* @description
* Badges are simple components in Ionic containing numbers or text. You can display a badge to indicate that there is new information associated with the item it is on.
* @see {@link /docs/components/#badges Badges Component Docs}
*/
@Directive({
selector: 'ion-badge'
})
export class Badge extends Ion {
constructor(config: Config, elementRef: ElementRef, renderer: Renderer) {
super(config, elementRef, renderer, 'badge');
@Component({
tag: 'ion-badge',
styleUrls: {
ios: 'badge.ios.scss',
md: 'badge.md.scss',
wp: 'badge.wp.scss'
}
}
})
export class Badge {}

View File

@@ -1,4 +1,6 @@
@import "../../themes/ionic.globals.wp";
@import "./badge";
// Windows Badge
// --------------------------------------------------

View File

@@ -1,4 +1,4 @@
import { NgModule } from '@angular/core';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule } from '../../../../..';
@@ -14,6 +14,7 @@ import { PageOneModule } from '../pages/page-one/page-one.module';
IonicModule.forRoot(AppComponent),
PageOneModule
],
bootstrap: [IonicApp]
bootstrap: [IonicApp],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}

View File

@@ -1,4 +1,4 @@
import { NgModule } from '@angular/core';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { IonicPageModule } from '../../../../../..';
import { PageOne } from './page-one';
@@ -12,6 +12,9 @@ import { PageOne } from './page-one';
],
entryComponents: [
PageOne,
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
})
export class PageOneModule {}

View File

@@ -1,7 +1,6 @@
import { CommonModule } from '@angular/common';
import { NgModule, ModuleWithProviders } from '@angular/core';
import { NgModule, ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BadgeModule } from '../badge/badge.module';
import { IconModule } from '../icon/icon.module';
import { Tab } from './tab';
@@ -12,7 +11,6 @@ import { Tabs } from './tabs';
/** @hidden */
@NgModule({
imports: [
BadgeModule,
CommonModule,
IconModule
],
@@ -27,7 +25,8 @@ import { Tabs } from './tabs';
TabButton,
TabHighlight,
Tabs
]
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class TabsModule {
public static forRoot(): ModuleWithProviders {