projects/storefrontlib/shared/components/card/card.component.ts
Properties |
| actions |
actions:
|
Type : Array<CardAction | CardLinkAction>
|
| Optional |
| deleteMsg |
deleteMsg:
|
Type : string
|
| Optional |
| header |
header:
|
Type : string
|
| Optional |
| img |
img:
|
Type : string
|
| Optional |
| paragraphs |
paragraphs:
|
Type : Array<literal type>
|
| Optional |
| text |
text:
|
Type : Array<string>
|
| Optional |
| textBold |
textBold:
|
Type : string
|
| Optional |
| title |
title:
|
Type : string
|
| Optional |
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ICON_TYPE } from '../../../cms-components/misc/icon/icon.model';
export interface CardAction {
event: string;
name: string;
}
export interface CardLinkAction {
link: string;
name: string;
}
export interface Card {
header?: string;
title?: string;
textBold?: string;
text?: Array<string>;
paragraphs?: Array<{ title?: string; text?: Array<string> }>;
img?: string;
actions?: Array<CardAction | CardLinkAction>;
deleteMsg?: string;
}
@Component({
selector: 'cx-card',
templateUrl: './card.component.html',
})
export class CardComponent implements OnInit {
iconTypes = ICON_TYPE;
@Output()
deleteCard: EventEmitter<number> = new EventEmitter();
@Output()
setDefaultCard: EventEmitter<number> = new EventEmitter();
@Output()
sendCard: EventEmitter<number> = new EventEmitter();
@Output()
editCard: EventEmitter<number> = new EventEmitter();
@Output()
cancelCard: EventEmitter<number> = new EventEmitter();
@Input()
border = false;
@Input()
editMode = false;
@Input()
isDefault = false;
@Input()
content: Card;
@Input()
fitToContainer = false;
@Input()
truncateText = false;
@Input()
charactersLimit = 100;
// ACTIONS
setEditMode(): void {
this.editMode = true;
}
cancelEdit(): void {
this.editMode = false;
this.cancelCard.emit(5);
}
delete(): void {
this.deleteCard.emit(1);
}
setDefault(): void {
this.isDefault = true;
this.setDefaultCard.emit(2);
}
send(): void {
this.sendCard.emit(3);
}
edit(): void {
this.editCard.emit(4);
}
constructor() {}
ngOnInit() {}
}