-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.component.ts
53 lines (47 loc) · 1.24 KB
/
card.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {
Component,
Input,
AfterContentInit,
ContentChild,
ElementRef
} from '@angular/core';
/**
* CardComponent is a flexible container that can be used to display various types
* of content, including user profiles, product rows, or any custom content.
* It supports a flexible layout with optional header and footer sections.
*/
@Component({
selector: 'wcard',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss'],
standalone: false
})
export class CardComponent implements AfterContentInit {
/**
* Custom CSS classes to apply to the card.
*/
@Input() cardClass = '';
/**
* Array of strings representing multiple content sections in the body.
* If provided, these sections will be rendered within the body of the card.
*/
@Input() sections: string[] | null = null;
/**
* Indicates if header content is present.
*/
hasHeader = false;
/**
* Indicates if footer content is present.
*/
hasFooter = false;
@ContentChild('header', { static: false }) headerContent:
| ElementRef
| undefined;
@ContentChild('footer', { static: false }) footerContent:
| ElementRef
| undefined;
ngAfterContentInit(): void {
this.hasHeader = !!this.headerContent;
this.hasFooter = !!this.footerContent;
}
}