Skip to content

Commit 2c530d9

Browse files
authored
Merge pull request #9102 from IgniteUI/SIvanova/igx-list-css-output
refactor(list): reduce compiled CSS
2 parents 7e92b07 + 974825f commit 2c530d9

File tree

7 files changed

+25
-85
lines changed

7 files changed

+25
-85
lines changed

projects/igniteui-angular/src/lib/core/styles/components/list/_list-component.scss

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,13 @@
6565
@extend %igx-list__item-line-subtitle !optional;
6666
}
6767

68-
@include e(empty) {
68+
@include m(empty) {
6969
@extend %igx-list !optional;
70-
@extend %igx-list-empty !optional;
70+
@extend %igx-list--empty !optional;
7171

72-
@include b(image) {
73-
@extend %igx-list-empty-image !optional;
72+
@include e(message) {
73+
@extend %igx-list__message--empty !optional;
7474
}
75-
76-
@include b(message) {
77-
@extend %igx-list-empty-message !optional;
78-
}
79-
}
80-
81-
@include e(empty, $m: custom) {
82-
@extend %igx-list-empty !optional;
8375
}
8476

8577
@include m(compact) {
@@ -93,12 +85,6 @@
9385
@extend %igx-list__item-actions--compact !optional;
9486
}
9587

96-
@include e(empty) {
97-
@include b(message) {
98-
@extend %igx-list-empty-message--compact !optional;
99-
}
100-
}
101-
10288
@include e(item-content) {
10389
@extend %igx-list-item-content--compact !optional;
10490
}
@@ -119,12 +105,6 @@
119105
@extend %igx-list__item-actions--cosy !optional;
120106
}
121107

122-
@include e(empty) {
123-
@include b(message) {
124-
@extend %igx-list-empty-message--cosy !optional;
125-
}
126-
}
127-
128108
@include e(item-content) {
129109
@extend %igx-list-item-content--cosy !optional;
130110
}

projects/igniteui-angular/src/lib/core/styles/components/list/_list-theme.scss

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -306,31 +306,18 @@
306306
}
307307
}
308308

309-
%igx-list-empty {
309+
%igx-list--empty {
310310
justify-content: center;
311311
align-items: center;
312312
}
313313

314-
%igx-list-empty-image {
315-
width: auto;
316-
max-height: 120px;
317-
}
318-
319-
%igx-list-empty-message {
314+
%igx-list__message--empty {
320315
text-align: center;
321316
color: --var($theme, 'item-text-color');
322317
padding: map-get($list-empty-padding, 'comfortable');
323318
z-index: 1;
324319
}
325320

326-
%igx-list-empty-message--cosy {
327-
padding: map-get($list-empty-padding, 'cosy');
328-
}
329-
330-
%igx-list-empty-message--compact {
331-
padding: map-get($list-empty-padding, 'compact');
332-
}
333-
334321
%igx-list-header {
335322
display: flex;
336323
align-items: center;
@@ -375,15 +362,15 @@
375362
%igx-list__item-actions {
376363
color: --var($theme, 'item-action-color-hover');
377364

378-
%igx-icon-display {
365+
igx-icon {
379366
color: --var($theme, 'item-action-color-hover')
380367
}
381368
}
382369

383370
%igx-list__item-thumbnail {
384371
color: --var($theme, 'item-thumbnail-color-hover');
385372

386-
%igx-icon-display {
373+
igx-icon {
387374
color: --var($theme, 'item-thumbnail-color-hover')
388375
}
389376
}
@@ -431,7 +418,7 @@
431418
display: none;
432419
}
433420

434-
%igx-icon-display {
421+
igx-icon {
435422
color: --var($theme, 'item-action-color')
436423
}
437424
}
@@ -462,7 +449,7 @@
462449
padding: 0;
463450
color: --var($theme, 'item-thumbnail-color');
464451

465-
> %igx-icon-display {
452+
> igx-icon {
466453
@include if-ltr() {
467454
margin: map-get($list-icon-margin, 'comfortable');
468455
}
@@ -472,8 +459,8 @@
472459
}
473460
}
474461

475-
> %igx-avatar-display {
476-
> %igx-icon-display {
462+
> igx-avatar {
463+
> igx-icon {
477464
margin: 0;
478465
}
479466
}
@@ -515,27 +502,27 @@
515502

516503
%igx-list__item-thumbnail--cosy {
517504
@include if-ltr() {
518-
> %igx-icon-display {
505+
> igx-icon {
519506
margin: map-get($list-icon-margin, 'cosy');
520507
}
521508
}
522509

523510
@include if-rtl() {
524-
> %igx-icon-display {
511+
> igx-icon {
525512
margin: map-get($list-icon-margin-rtl, 'cosy');
526513
}
527514
}
528515
}
529516

530517
%igx-list__item-thumbnail--compact {
531518
@include if-ltr() {
532-
> %igx-icon-display {
519+
> igx-icon {
533520
margin: map-get($list-icon-margin, 'compact');
534521
}
535522
}
536523

537524
@include if-rtl() {
538-
> %igx-icon-display {
525+
> igx-icon {
539526
margin: map-get($list-icon-margin-rtl, 'compact');
540527
}
541528
}
@@ -569,15 +556,15 @@
569556
%igx-list__item-actions {
570557
color: --var($theme, 'item-action-color-active');
571558

572-
%igx-icon-display {
559+
igx-icon {
573560
color: --var($theme, 'item-action-color-active')
574561
}
575562
}
576563

577564
%igx-list__item-thumbnail {
578565
color: --var($theme, 'item-thumbnail-color-active');
579566

580-
%igx-icon-display {
567+
igx-icon {
581568
color: --var($theme, 'item-thumbnail-color-active')
582569
}
583570
}

projects/igniteui-angular/src/lib/list/list.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<ng-content></ng-content>
22

33
<ng-template #defaultEmptyList>
4-
<article class="message">
4+
<article class="igx-list__message">
55
{{resourceStrings.igx_list_no_items}}
66
</article>
77
</ng-template>
88

99
<ng-template #defaultDataLoading>
10-
<article class="message">
10+
<article class="igx-list__message">
1111
{{resourceStrings.igx_list_loading}}
1212
</article>
1313
</ng-template>

projects/igniteui-angular/src/lib/list/list.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ describe('List', () => {
268268
expect(list.cssClass).toBeFalsy();
269269
expect(list.isListEmpty).toBeTruthy();
270270

271-
const noItemsMessage = fixture.debugElement.query(By.css('.message'));
271+
const noItemsMessage = fixture.debugElement.query(By.css('.igx-list__message'));
272272
expect(noItemsMessage.nativeElement.textContent.trim()).toBe(listNoItemsMessage);
273273
});
274274

@@ -298,7 +298,7 @@ describe('List', () => {
298298
expect(list.cssClass).toBeFalsy();
299299
expect(list.isListEmpty).toBeTruthy();
300300

301-
const noItemsMessage = fixture.debugElement.query(By.css('.message'));
301+
const noItemsMessage = fixture.debugElement.query(By.css('.igx-list__message'));
302302
expect(noItemsMessage.nativeElement.textContent.trim()).toBe(listLoadingItemsMessage);
303303
});
304304

@@ -312,7 +312,7 @@ describe('List', () => {
312312

313313
verifyItemsCount(list, 3);
314314

315-
const noItemsMessage = fixture.debugElement.query(By.css('.message'));
315+
const noItemsMessage = fixture.debugElement.query(By.css('.igx-list__message'));
316316
expect(noItemsMessage.nativeElement.textContent.trim()).toBe(listLoadingItemsMessage);
317317

318318
list.isLoading = false;

projects/igniteui-angular/src/lib/list/list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ export class IgxListComponent extends IgxListBaseDirective {
457457
* let isEmpty = this.list.isListEmpty;
458458
* ```
459459
*/
460-
@HostBinding('class.igx-list-empty')
460+
@HostBinding('class.igx-list--empty')
461461
public get isListEmpty(): boolean {
462462
return !this.children || this.children.length === 0;
463463
}

src/app/list/list.sample.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,7 @@ <h4 class="sample-title">
256256
Empty list
257257
<i class="light">w/ Default template</i>
258258
</h4>
259-
260-
<igx-input-group type="search" style="margin-bottom: 16px" [hidden]="fruits.length === 0">
261-
<igx-prefix>
262-
<igx-icon>search</igx-icon>
263-
</igx-prefix>
264-
<input #searchFruits igxInput type="text" placeholder="Search List" [(ngModel)]="fruitsSearch" />
265-
<igx-suffix *ngIf="searchFruits.value.length > 0" (click)="searchFruits.value = ''">
266-
<igx-icon>clear</igx-icon>
267-
</igx-suffix>
268-
</igx-input-group>
269-
270-
<div class="list-sample list-sample--add">
259+
<div class="list-sample">
271260
<igx-card>
272261
<igx-list [displayDensity]="density" [hidden]="fruitsFilteredItemsCount === 0" [igxFilter]="fruitsFilterOptions" (filtered)="fruitsFiltered($event)">
273262
<igx-list-item *ngFor="let fruit of fruits" [attr.data-fruit-id]="fruit.id">
@@ -276,13 +265,6 @@ <h4 class="sample-title">
276265
</igx-list-item>
277266
</igx-list>
278267
</igx-card>
279-
<div class="igx-list__empty--custom" [hidden]="fruitsFilteredItemsCount > 0 || searchFruits.value === ''">
280-
No filtered items.
281-
</div>
282-
<button igxButton="fab" igxButtonColor="white" igxButtonBackground="#0375be" igRipple="white" (click)="addFruitDialog.open()"
283-
[hidden]="fruits.length === 0" style="position: absolute; bottom: 24px; right: 24px">
284-
<igx-icon>add</igx-icon>
285-
</button>
286268
</div>
287269
</article>
288270

src/app/list/list.sample.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@
99
margin: 30px auto 0;
1010
}
1111

12-
.igx-list__empty--custom {
13-
text-align: center;
14-
opacity: .7;
15-
}
16-
17-
.list-sample--add {
18-
position: relative;
19-
}
20-
2112
.sample-column.bootstrap {
2213
display: none;
2314
}

0 commit comments

Comments
 (0)