mirror of https://github.com/abpframework/abp.git
committed by
GitHub
10 changed files with 81 additions and 13 deletions
@ -0,0 +1,9 @@ |
|||||
|
import { Component } from '@angular/core'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'abp-card-body', |
||||
|
template: `<div class="card-body">
|
||||
|
<ng-content></ng-content> |
||||
|
</div>`,
|
||||
|
}) |
||||
|
export class CardBodyComponent {} |
||||
@ -0,0 +1,9 @@ |
|||||
|
import { Component } from '@angular/core'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'abp-card-title', |
||||
|
template: `<div class="card-title">
|
||||
|
<ng-content></ng-content> |
||||
|
</div>`,
|
||||
|
}) |
||||
|
export class CardTitleComponent {} |
||||
@ -0,0 +1,22 @@ |
|||||
|
import { Component, ContentChild, Input } from '@angular/core'; |
||||
|
import { CardBodyComponent } from './card-body.component'; |
||||
|
import { CardTitleComponent } from './card-title.component'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'abp-card', |
||||
|
template: ` <div class="card" [ngClass]="cardClass" [ngStyle]="cardStyle">
|
||||
|
<ng-content *ngIf="cardTitleTemplate" select="abp-card-title"></ng-content> |
||||
|
<ng-content *ngIf="cardBodyTemplate" select="abp-card-body"></ng-content> |
||||
|
</div>`,
|
||||
|
}) |
||||
|
export class CardComponent { |
||||
|
@Input() cardClass: string; |
||||
|
|
||||
|
@Input() cardStyle: string; |
||||
|
|
||||
|
@ContentChild(CardBodyComponent) |
||||
|
cardBodyTemplate?: CardBodyComponent; |
||||
|
|
||||
|
@ContentChild(CardTitleComponent) |
||||
|
cardTitleTemplate?: CardTitleComponent; |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { NgModule } from '@angular/core'; |
||||
|
import { CardBodyComponent } from './card-body.component'; |
||||
|
import { CardTitleComponent } from './card-title.component'; |
||||
|
import { CardComponent } from './card.component'; |
||||
|
|
||||
|
const declarationsWithExports = [CardComponent, CardBodyComponent, CardTitleComponent]; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [...declarationsWithExports], |
||||
|
imports: [CommonModule], |
||||
|
exports: [...declarationsWithExports], |
||||
|
}) |
||||
|
export class CardModule {} |
||||
@ -0,0 +1,4 @@ |
|||||
|
export * from './card.module'; |
||||
|
export * from './card.component'; |
||||
|
export * from './card-body.component'; |
||||
|
export * from './card-title.component'; |
||||
Loading…
Reference in new issue