Alert

O componente de alerta utiliza o Dialog por debaixo dos panos e serve como uma abstração de janela para feedbacks do sistema podendo optar por sucesso, alerta, error e informação.

Uso

page-alert.component.html
<cat-toolbar [config]="getToolbarInfo()">
  <nav buttons>
    <cat-success-button class="mr-8" (click)="openAlert('success')">Sucesso</cat-success-button>
    <cat-warning-button class="mr-8" (click)="openAlert('warning')">Atenção</cat-warning-button>
    <cat-danger-button class="mr-8" (click)="openAlert('error')">Error</cat-danger-button>
    <cat-info-button (click)="openAlert('info')">Informação</cat-info-button>
  </nav>
</cat-toolbar>
page-alert.component.ts
import { Component } from '@angular/core';
import { CatAlertService, CatAlertType } from '@catrx/ui/alert';
import { CatComponentBase } from '@catrx/ui/common';

@Component({
  templateUrl: './page-alert.component.html',
})
export class PageAlertComponent extends CatComponentBase {
  constructor(private alertService: CatAlertService) {
    super();
  }

  openAlert(type: CatAlertType) {
    this.alertService.show({
      type,
      message: `Alerta de Tipo: <b>${type}</b>`,
    });
  }
}

Overview

Last updated

Was this helpful?