import { Component, signal } from '@angular/core';
import {
ChipComponent,
type ChipSize,
type ChipVariant,
} from '@africanies/africanies-ui';
import { DemoSectionComponent } from '../shared/demo-section.component';
import { PageHeaderComponent } from '../shared/page-header.component';
import { CHIP_ICON_REMOVE, CHIP_TABLE, CHIP_VARIANTS } from '../snippets';
/**
* Chip catalog — status labels with soft fills and dark-safe tones.
*/
@Component({
selector: 'app-chip-page',
standalone: true,
imports: [ChipComponent, PageHeaderComponent, DemoSectionComponent],
template: `
@for (v of variants; track v) {
{{ labels[v] }}
}
@for (s of sizes; track s) {
Size {{ s }}
Size {{ s }}
}
Pending review
Verified
@for (tag of removableTags(); track tag) {
{{ tag.label }}
}
@if (removableTags().length === 0) {
}
Delivered
In transit
Pending
Exception
`,
})
export class ChipPage {
protected readonly variants: ChipVariant[] = [
'neutral',
'success',
'warning',
'danger',
'info',
'violet',
'teal',
'rose',
'cyan',
'export',
'import',
];
protected readonly sizes: ChipSize[] = ['sm', 'md'];
protected readonly labels: Record = {
neutral: 'Neutral',
success: 'Delivered',
warning: 'Pending',
danger: 'Exception',
info: 'Info',
violet: 'Violet',
teal: 'Teal',
rose: 'Rose',
cyan: 'Cyan',
export: 'SFN / export',
import: 'STN / import',
};
protected readonly removableTags = signal([
{ id: 1, label: 'Lagos', variant: 'export' as ChipVariant },
{ id: 2, label: 'Exception', variant: 'danger' as ChipVariant },
{ id: 3, label: 'In transit', variant: 'import' as ChipVariant },
]);
protected readonly variantsCode = CHIP_VARIANTS;
protected readonly iconRemoveCode = CHIP_ICON_REMOVE;
protected readonly tableCode = CHIP_TABLE;
protected removeTag(id: number): void {
this.removableTags.update((tags) => tags.filter((t) => t.id !== id));
}
protected resetTags(): void {
this.removableTags.set([
{ id: 1, label: 'Lagos', variant: 'export' },
{ id: 2, label: 'Exception', variant: 'danger' },
{ id: 3, label: 'In transit', variant: 'import' },
]);
}
}