Skip to content

Commit 0ded359

Browse files
committed
feat(inline-loading): Add active/inactive states
1 parent 61ac981 commit 0ded359

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/inline-loading/inline-loading.component.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
<div class="bx--inline-loading__animation">
1313
<div
1414
*ngIf="success === false"
15-
class="bx--loading bx--loading--small">
15+
class="bx--loading bx--loading--small"
16+
[ngClass]="{
17+
'bx--loading--stop': !isActive
18+
}">
1619
<svg class="bx--loading__svg" viewBox="-75 -75 150 150">
1720
<circle cx="0" cy="0" r="37.5"></circle>
1821
</svg>
@@ -30,22 +33,20 @@ import {
3033
export class InlineLoading {
3134
/**
3235
* Specify the text description for the loading state.
33-
*
34-
* @memberof InlineLoading
3536
*/
3637
@Input() loadingText;
3738
/**
3839
* Specify the text description for the success state.
39-
*
40-
* @memberof InlineLoading
4140
*/
4241
@Input() successText;
4342
/**
4443
* Provide a delay for the `setTimeout` for success.
45-
*
46-
* @memberof InlineLoading
4744
*/
4845
@Input() successDelay = 1500;
46+
/**
47+
* set to `false` to stop the loading animation
48+
*/
49+
@Input() isActive = true;
4950

5051
/**
5152
* Returns value `true` if the component is in the success state.
@@ -69,16 +70,13 @@ export class InlineLoading {
6970
* Emits event after the success state is active
7071
*
7172
* @type {EventEmitter<any>}
72-
* @memberof InlineLoading
7373
*/
7474
@Output() onSuccess: EventEmitter<any> = new EventEmitter();
7575

7676
@HostBinding("class.bx--inline-loading") loadingClass = true;
7777

7878
/**
7979
* Set to `true` if the action is completed successfully.
80-
*
81-
* @memberof InlineLoading
8280
*/
8381
protected _success = false;
8482
}

src/inline-loading/inline-loading.stories.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { storiesOf, moduleMetadata } from "@storybook/angular";
22
import { withNotes } from "@storybook/addon-notes";
33
import { action } from "@storybook/addon-actions";
4-
import { withKnobs, boolean, object } from "@storybook/addon-knobs/angular";
4+
import { withKnobs, text, object } from "@storybook/addon-knobs/angular";
55

66
import { InlineLoadingModule, ButtonModule } from "../";
77

@@ -19,7 +19,7 @@ storiesOf("Inline Loading", module)
1919
`,
2020
props: {
2121
onSuccess: action("onSuccess"),
22-
loadingText: "Loading data...",
23-
successText: "Data loaded."
22+
loadingText: text("The loading text", "Loading data..."),
23+
successText: text("The sucess text", "Data loaded.")
2424
}
2525
}));

0 commit comments

Comments
 (0)