Asymmetrik/ngx-starter

View on GitHub
src/app/common/notification/notification.component.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { NgTemplateOutlet } from '@angular/common';
import {
    ChangeDetectionStrategy,
    Component,
    TemplateRef,
    booleanAttribute,
    contentChild,
    input
} from '@angular/core';

@Component({
    selector: 'notification',
    templateUrl: './notification.component.html',
    styleUrls: ['./notification.component.scss'],
    standalone: true,
    imports: [NgTemplateOutlet],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class NotificationComponent {
    readonly actionTemplate = contentChild<TemplateRef<unknown>>('notificationActions');

    readonly notificationType = input<'info' | 'success' | 'warning' | 'danger'>('info');
    readonly message = input('');
    readonly showActions = input(false, { transform: booleanAttribute });
    readonly small = input(false, { transform: booleanAttribute });
}