Skip to content

Commit 7980050

Browse files
authored
Merge pull request #349 from youda97/skeleton-nput
feat(input): Add skeleton state
2 parents 1037af6 + 7602705 commit 7980050

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

src/input/input.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class TextInput {
2121
@Input() theme: "light" | "dark" = "dark";
2222

2323
@HostBinding("class.bx--text-input") inputClass = true;
24+
@HostBinding("class.bx--skeleton") @Input() skeleton = false;
2425
@HostBinding("class.bx--text-input--light") get isLightTheme() {
2526
return this.theme === "light";
2627
}

src/input/input.stories.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,21 @@ storiesOf("Input", module).addDecorator(
3333
props: {
3434
theme: select("Theme", ["dark", "light"], "dark")
3535
}
36+
}))
37+
.add("Skeleton", () => ({
38+
template: `
39+
<div style="width: 300px">
40+
<ibm-label skeleton="true">
41+
<input ibmText skeleton="true">
42+
</ibm-label>
43+
<br>
44+
<input ibmText skeleton="true">
45+
</div>
46+
<br><br>
47+
<div style="width: 160px">
48+
<ibm-label skeleton="true">
49+
<div ibmTextArea skeleton="true"></div>
50+
</ibm-label>
51+
</div>
52+
`
3653
}));

src/input/label.component.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ import {
3131
@Component({
3232
selector: "ibm-label",
3333
template: `
34-
<label [for]="labelInputID" class="bx--label"><ng-content></ng-content></label>
34+
<label
35+
[for]="labelInputID"
36+
class="bx--label"
37+
[ngClass]="{
38+
'bx--skeleton': skeleton
39+
}">
40+
<ng-content></ng-content>
41+
</label>
3542
<ng-content select="input,textarea,div"></ng-content>
3643
`
3744
})
@@ -55,6 +62,10 @@ export class Label implements AfterContentInit {
5562
* @memberof Label
5663
*/
5764
@Input() labelState: "success" | "warning" | "error" | "" = "";
65+
/**
66+
* Set to `true` for a loading label.
67+
*/
68+
@Input() skeleton = false;
5869

5970
@HostBinding("class.bx--form-item") labelClass = true;
6071

src/input/text-area.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class TextArea {
2121
@Input() theme: "light" | "dark" = "dark";
2222

2323
@HostBinding("class.bx--text-area") baseClass = true;
24+
@HostBinding("class.bx--skeleton") @Input() skeleton = false;
2425
@HostBinding("class.bx--text-area--light") get isLightTheme() {
2526
return this.theme === "light";
2627
}

0 commit comments

Comments
 (0)