Skip to content

Commit b4a46ab

Browse files
authored
Merge branch 'master' into skeleton-structured-list
2 parents 3d0efcb + 40bb9c3 commit b4a46ab

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

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
}));

0 commit comments

Comments
 (0)