Skip to content

Commit e6f7584

Browse files
authored
Merge branch 'master' into skeleton-breadcrumb
2 parents 43cd036 + 688ab7e commit e6f7584

27 files changed

+349
-21
lines changed

src/button/button.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class Button implements OnInit {
3737
@HostBinding("class.bx--btn--ghost") ghost = false;
3838
@HostBinding("class.bx--btn--danger") danger = false;
3939
@HostBinding("class.bx--btn--danger--primary") dangerPrimary = false;
40+
@HostBinding("class.bx--skeleton") @Input() skeleton = false;
4041
@HostBinding("class.bx--btn--sm") smallSize = false;
4142

4243
ngOnInit() {

src/button/button.stories.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,11 @@ storiesOf("Button", module)
2929
props: {
3030
size: select("Size of the buttons", ["normal", "sm"], "normal")
3131
}
32+
}))
33+
.add("Skeleton", () => ({
34+
template: `
35+
<button ibmButton skeleton="true"></button>
36+
&nbsp;
37+
<button ibmButton skeleton="true" size="sm"></button>
38+
`
3239
}));

src/checkbox/checkbox.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ export class CheckboxChange {
7070
[attr.aria-checked]="(indeterminate ? 'mixed' : checked)"
7171
(change)="onChange($event)"
7272
(click)="onClick($event)">
73-
<label [for]="id" class="bx--checkbox-label">
73+
<label
74+
[for]="id"
75+
class="bx--checkbox-label"
76+
[ngClass]="{
77+
'bx--skeleton' : skeleton
78+
}">
7479
<ng-content></ng-content>
7580
</label>
7681
`,
@@ -107,6 +112,10 @@ export class Checkbox implements ControlValueAccessor, AfterViewInit {
107112
* Set to `true` for a disabled checkbox.
108113
*/
109114
@Input() disabled = false;
115+
/**
116+
* Set to `true` for a loading checkbox.
117+
*/
118+
@Input() skeleton = false;
110119
/**
111120
* Sets the name attribute on the `input` element.
112121
*/

src/checkbox/checkbox.stories.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ storiesOf("Checkbox", module).addDecorator(
2828
onChange: action("Change fired!"),
2929
onIndeterminateChange: action("Indeterminate change fired!")
3030
}
31-
}));
31+
}))
32+
.add("Skeleton", () => ({
33+
template: `<ibm-checkbox skeleton="true"></ibm-checkbox>`
34+
}));

src/code-snippet/code-snippet.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ export enum SnippetType {
3131
3232
<ng-template #notInline>
3333
<div class="bx--snippet-container" [attr.aria-label]="translations.CODE_SNIPPET_TEXT">
34-
<pre><ng-container *ngTemplateOutlet="codeTemplate"></ng-container></pre>
34+
<ng-container *ngIf="skeleton">
35+
<span *ngIf="display === 'single'; else multiSkeleton"></span>
36+
<ng-template #multiSkeleton>
37+
<span></span>
38+
<span></span>
39+
<span></span>
40+
</ng-template>
41+
</ng-container>
42+
<pre *ngIf="!skeleton"><ng-container *ngTemplateOutlet="codeTemplate"></ng-container></pre>
3543
</div>
3644
<button
45+
*ngIf="!skeleton"
3746
class="bx--snippet-button"
3847
[attr.aria-label]="translations.COPY_CODE"
3948
(click)="onCopyButtonClicked()"
@@ -118,6 +127,7 @@ export class CodeSnippet {
118127
@Input() feedbackTimeout = 2000;
119128

120129
@HostBinding("class.bx--snippet--expand") @Input() expanded = false;
130+
@HostBinding("class.bx--skeleton") @Input() skeleton = false;
121131

122132
@HostBinding("class.bx--snippet") snippetClass = true;
123133
@HostBinding("class.bx--snippet--single") get snippetSingleClass() {

src/code-snippet/code-snippet.stories.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,13 @@ storiesOf("CodeSnippet", module).addDecorator(
6666
inlineCode,
6767
theme: select("Theme", ["dark", "light"], "dark")
6868
}
69+
}))
70+
.add("Skeleton", () => ({
71+
template: `
72+
<div style="width: 800px">
73+
<ibm-code-snippet display="single" skeleton="true"></ibm-code-snippet>
74+
<br>
75+
<ibm-code-snippet display="multi" skeleton="true"></ibm-code-snippet>
76+
</div>
77+
`
6978
}));

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)