Skip to content

Commit f819a15

Browse files
committed
feat(Loading): Add active/inactive states
1 parent 0ded359 commit f819a15

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/loading/loading.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { I18n } from "./../i18n/i18n.module";
55
selector: "ibm-loading",
66
template: `
77
<div
8-
[ngClass]="{'bx--loading--small': size === 'sm'}"
8+
[ngClass]="{
9+
'bx--loading--small': size === 'sm',
10+
'bx--loading--stop': !isActive && !overlay,
11+
'bx--loading-overlay--stop': !isActive && overlay
12+
}"
913
class="bx--loading">
1014
<svg class="bx--loading__svg" viewBox="-75 -75 150 150">
1115
<title>{{title}}</title>
@@ -21,17 +25,21 @@ export class Loading {
2125
*/
2226
@Input() title = this.i18n.get().LOADING.TITLE;
2327

28+
/**
29+
* set to `false` to stop the loading animation
30+
* @type {boolean}
31+
*/
32+
@Input() isActive = true;
33+
2434
/**
2535
* Specify the size of the button
2636
* @type {("normal" | "sm")}
27-
* @memberof Loading
2837
*/
2938
@Input() size: "normal" | "sm" = "normal";
3039

3140
/**
3241
* Set to `true` to make loader with an overlay.
3342
* @type {boolean}
34-
* @memberof Loading
3543
*/
3644
@Input() @HostBinding("class.bx--loading-overlay") overlay = false;
3745

src/loading/loading.stories.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ storiesOf("Loading", module).addDecorator(
1212
.addDecorator(withKnobs)
1313
.add("Basic", () => ({
1414
template: `
15-
<ibm-loading [size]="size" [overlay]="overlay"></ibm-loading>
15+
<ibm-loading [isActive]="isActive" [size]="size" [overlay]="overlay"></ibm-loading>
1616
`,
1717
props: {
18+
isActive: boolean("Active", true),
1819
overlay: boolean("With overlay", false),
1920
size: select("Size of the loading circle", ["normal", "sm"], "normal")
2021
}

0 commit comments

Comments
 (0)