Skip to content

Commit 4cd1dbd

Browse files
committed
feat(select): Add skeleton state
1 parent 688ab7e commit 4cd1dbd

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/select/select.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
2828
selector: "ibm-select",
2929
template: `
3030
<div class="bx--form-item">
31+
<label *ngIf="skeleton" [attr.for]="id" class="bx--label bx--skeleton"></label>
3132
<div
3233
[ngClass]="{
3334
'bx--select--inline': display === 'inline',
34-
'bx--select--light': theme === 'light'
35+
'bx--select--light': theme === 'light',
36+
'bx--skeleton': skeleton
3537
}"
3638
class="bx--select">
37-
<label [attr.for]="id" class="bx--label">{{label}}</label>
39+
<label *ngIf="!skeleton" [attr.for]="id" class="bx--label">{{label}}</label>
3840
<select
3941
#select
4042
[attr.id]="id"
@@ -43,7 +45,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
4345
class="bx--select-input">
4446
<ng-content></ng-content>
4547
</select>
46-
<svg class="bx--select__arrow" width="10" height="5" viewBox="0 0 10 5">
48+
<svg *ngIf="!skeleton" class="bx--select__arrow" width="10" height="5" viewBox="0 0 10 5">
4749
<path d="M0 0l5 4.998L10 0z" fill-rule="evenodd" />
4850
</svg>
4951
</div>
@@ -79,6 +81,10 @@ export class Select implements ControlValueAccessor {
7981
* Set to true to disable component.
8082
*/
8183
@Input() disabled = false;
84+
/**
85+
* Set to true for a loading select.
86+
*/
87+
@Input() skeleton = false;
8288
/**
8389
* `light` or `dark` select theme
8490
*/

src/select/select.stories.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,11 @@ storiesOf("Select", module).addDecorator(
4444
props: {
4545
model: "default"
4646
}
47+
}))
48+
.add("Skeleton", () => ({
49+
template: `
50+
<div style="width: 300px">
51+
<ibm-select skeleton="true"></ibm-select>
52+
</div>
53+
`
4754
}));

0 commit comments

Comments
 (0)