/**
* Playground snippets — Alert.
*/
export /**
*
*/
const ALERT_VARIANTS = `
// Inline banners for info / success / warning / danger.
// Parent owns visibility. Not a toast, and not for full-page fetch failures.
import { Component, signal } from '@angular/core';
import { AlertComponent, ButtonComponent, type AlertVariant } from '@africanies/africanies-ui';
@Component({
selector: 'app-alert-demo',
standalone: true,
imports: [AlertComponent, ButtonComponent],
template: \`
@for (v of variants; track v) {
}
\`,
})
export class AlertDemo {
readonly variants: AlertVariant[] = ['info', 'success', 'warning', 'danger'];
readonly titles: Record = {
info: 'Document checklist',
success: 'Submitted',
warning: 'Rates may be stale',
danger: 'Cannot release',
};
readonly messages: Record = {
info: 'Commercial invoice and packing list are still required.',
success: 'Shipment SFN-1042 was submitted to the carrier.',
warning: 'Last rate pull was more than 4 hours ago.',
danger: 'Customs hold blocks release until documents are approved.',
};
}
`;
export /**
*
*/
const ALERT_DISMISSIBLE = `
// Dismissible by default — listen to (dismissed) and unmount with @if.
// Set [dismissible]="false" when the notice has to stay.
import { Component, signal } from '@angular/core';
import { AlertComponent, ButtonComponent } from '@africanies/africanies-ui';
@Component({
selector: 'app-alert-dismiss-demo',
standalone: true,
imports: [AlertComponent, ButtonComponent],
template: \`
@if (showBanner()) {
} @else {
}
\`,
})
export class AlertDismissDemo {
readonly showBanner = signal(true);
refresh(): void {
// refetch rates…
this.showBanner.set(false);
}
}
`;