File tree Expand file tree Collapse file tree 6 files changed +102
-0
lines changed
Expand file tree Collapse file tree 6 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 6363 "RESET_SEARCH" : " Reset search"
6464 }
6565 },
66+ "LOADING" : {
67+ "TITLE" : " Loading"
68+ },
6669 "MODAL" : {
6770 "CLOSE" : " Close modal"
6871 },
Original file line number Diff line number Diff line change @@ -24,3 +24,4 @@ export * from "./tiles/tiles.module";
2424export * from "./progress-indicator/progress-indicator.module" ;
2525export * from "./i18n/i18n.module" ;
2626export * from "./pagination/pagination.module" ;
27+ export * from "./loading/loading.module" ;
Original file line number Diff line number Diff line change 1+ import { async , ComponentFixture , TestBed } from "@angular/core/testing" ;
2+
3+ import { Loading } from "./loading.component" ;
4+ import { I18nModule } from "../i18n/i18n.module" ;
5+
6+ describe ( "Loading" , ( ) => {
7+ let component : Loading ;
8+ let fixture : ComponentFixture < Loading > ;
9+
10+ beforeEach ( ( ) => {
11+ TestBed . configureTestingModule ( {
12+ declarations : [ Loading ] ,
13+ imports : [ I18nModule ]
14+ } ) ;
15+
16+ fixture = TestBed . createComponent ( Loading ) ;
17+ component = fixture . componentInstance ;
18+ } ) ;
19+
20+ it ( "should work" , ( ) => {
21+ expect ( component instanceof Loading ) . toBe ( true ) ;
22+ } ) ;
23+ } ) ;
Original file line number Diff line number Diff line change 1+ import { Component , Input , HostBinding } from "@angular/core" ;
2+ import { I18n } from "./../i18n/i18n.module" ;
3+
4+ @Component ( {
5+ selector : "ibm-loading" ,
6+ template : `
7+ <div
8+ [ngClass]="{'bx--loading--small': size === 'sm'}"
9+ class="bx--loading">
10+ <svg class="bx--loading__svg" viewBox="-75 -75 150 150">
11+ <title>{{title}}</title>
12+ <circle cx="0" cy="0" r="37.5" />
13+ </svg>
14+ </div>
15+ `
16+ } )
17+ export class Loading {
18+ /**
19+ * Accessible title for the loading circle.
20+ * Defaults to the `LOADING.TITLE` value from the i18n service.
21+ */
22+ @Input ( ) title = this . i18n . get ( ) . LOADING . TITLE ;
23+
24+ /**
25+ * Specify the size of the button
26+ * @type {("normal" | "sm") }
27+ * @memberof Loading
28+ */
29+ @Input ( ) size : "normal" | "sm" = "normal" ;
30+
31+ /**
32+ * Set to `true` to make loader with an overlay.
33+ * @type {boolean }
34+ * @memberof Loading
35+ */
36+ @Input ( ) @HostBinding ( "class.bx--loading-overlay" ) overlay = false ;
37+
38+ constructor ( private i18n : I18n ) { }
39+ }
Original file line number Diff line number Diff line change 1+ import { NgModule } from "@angular/core" ;
2+ import { CommonModule } from "@angular/common" ;
3+
4+ import { Loading } from "./loading.component" ;
5+ import { I18nModule } from "./../i18n/i18n.module" ;
6+
7+ export { Loading } from "./loading.component" ;
8+
9+ @NgModule ( {
10+ declarations : [ Loading ] ,
11+ exports : [ Loading ] ,
12+ imports : [ CommonModule , I18nModule ]
13+ } )
14+ export class LoadingModule { }
Original file line number Diff line number Diff line change 1+ import { storiesOf , moduleMetadata } from "@storybook/angular" ;
2+ import { action } from "@storybook/addon-actions" ;
3+ import { withKnobs , boolean } from "@storybook/addon-knobs/angular" ;
4+
5+ import { LoadingModule } from "../" ;
6+
7+ storiesOf ( "Loading" , module ) . addDecorator (
8+ moduleMetadata ( {
9+ imports : [ LoadingModule ]
10+ } )
11+ )
12+ . addDecorator ( withKnobs )
13+ . add ( "Basic" , ( ) => ( {
14+ template : `
15+ <ibm-loading [overlay]="true"></ibm-loading>
16+ `
17+ } ) )
18+ . add ( "Small" , ( ) => ( {
19+ template : `
20+ <ibm-loading size="sm"></ibm-loading>
21+ `
22+ } ) ) ;
You can’t perform that action at this time.
0 commit comments