Skip to content

Commit a36ebd3

Browse files
fix(module:card): use skeleton instead to card-loading-content (#8528)
1 parent 85301e0 commit a36ebd3

5 files changed

Lines changed: 12 additions & 61 deletions

File tree

components/card/card-loading.component.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

components/card/card.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import { NzConfigKey, NzConfigService, WithConfig } from 'ng-zorro-antd/core/con
2626
import { NzOutletModule } from 'ng-zorro-antd/core/outlet';
2727
import { BooleanInput, NgStyleInterface, NzSizeDSType } from 'ng-zorro-antd/core/types';
2828
import { InputBoolean } from 'ng-zorro-antd/core/util';
29+
import { NzSkeletonModule } from 'ng-zorro-antd/skeleton';
2930

3031
import { NzCardGridDirective } from './card-grid.directive';
31-
import { NzCardLoadingComponent } from './card-loading.component';
3232
import { NzCardTabComponent } from './card-tab.component';
3333

3434
const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'card';
@@ -67,10 +67,10 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'card';
6767
}
6868
6969
<div class="ant-card-body" [ngStyle]="nzBodyStyle">
70-
@if (!nzLoading) {
71-
<ng-content />
70+
@if (nzLoading) {
71+
<nz-skeleton [nzActive]="true" [nzTitle]="false" [nzParagraph]="{ rows: 4 }"></nz-skeleton>
7272
} @else {
73-
<nz-card-loading />
73+
<ng-content />
7474
}
7575
</div>
7676
@if (nzActions.length) {
@@ -94,7 +94,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'card';
9494
'[class.ant-card-contain-tabs]': '!!listOfNzCardTabComponent',
9595
'[class.ant-card-rtl]': `dir === 'rtl'`
9696
},
97-
imports: [NzOutletModule, NgTemplateOutlet, NgStyle, NzCardLoadingComponent],
97+
imports: [NzOutletModule, NgTemplateOutlet, NgStyle, NzSkeletonModule],
9898
standalone: true
9999
})
100100
export class NzCardComponent implements OnDestroy, OnInit {

components/card/card.module.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,12 @@ import { BidiModule } from '@angular/cdk/bidi';
77
import { NgModule } from '@angular/core';
88

99
import { NzCardGridDirective } from './card-grid.directive';
10-
import { NzCardLoadingComponent } from './card-loading.component';
1110
import { NzCardMetaComponent } from './card-meta.component';
1211
import { NzCardTabComponent } from './card-tab.component';
1312
import { NzCardComponent } from './card.component';
1413

1514
@NgModule({
16-
imports: [NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardLoadingComponent, NzCardTabComponent],
17-
exports: [
18-
BidiModule,
19-
NzCardComponent,
20-
NzCardGridDirective,
21-
NzCardMetaComponent,
22-
NzCardLoadingComponent,
23-
NzCardTabComponent
24-
]
15+
imports: [NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardTabComponent],
16+
exports: [BidiModule, NzCardComponent, NzCardGridDirective, NzCardMetaComponent, NzCardTabComponent]
2517
})
2618
export class NzCardModule {}

components/card/card.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ describe('card', () => {
8080
const card = fixture.debugElement.query(By.directive(NzCardComponent));
8181
fixture.detectChanges();
8282
expect(card.nativeElement.classList).toContain('ant-card-loading');
83-
expect(card.nativeElement.querySelector('nz-card-loading').classList).toContain('ant-card-loading-content');
83+
const skeleton = card.nativeElement.querySelector('nz-skeleton');
84+
expect(skeleton).toBeTruthy();
85+
expect(skeleton.classList).toContain('ant-skeleton-active');
8486
});
8587
it('should grid work', () => {
8688
const fixture = TestBed.createComponent(NzDemoCardGridCardComponent);

components/card/public-api.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*/
55

66
export * from './card-grid.directive';
7-
export * from './card.component';
8-
export * from './card.module';
9-
export * from './card-loading.component';
107
export * from './card-meta.component';
118
export * from './card-tab.component';
9+
export * from './card.component';
10+
export * from './card.module';

0 commit comments

Comments
 (0)