1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +00:00
Files
browser/libs/components/src/banner/banner.component.ts
Victoria League 09169cac71 [CL-254] Rename 500 colors to 600 to prep for UI redesign (#8623)
* [CL-254] Rename 500 colors to 600 to prep for UI redesign

---------

Co-authored-by: Will Martin <contact@willmartian.com>
2024-04-05 10:58:32 -04:00

41 lines
1000 B
TypeScript

import { Component, Input, OnInit, Output, EventEmitter } from "@angular/core";
type BannerTypes = "premium" | "info" | "warning" | "danger";
const defaultIcon: Record<BannerTypes, string> = {
premium: "bwi-star",
info: "bwi-info-circle",
warning: "bwi-exclamation-triangle",
danger: "bwi-error",
};
@Component({
selector: "bit-banner",
templateUrl: "./banner.component.html",
})
export class BannerComponent implements OnInit {
@Input("bannerType") bannerType: BannerTypes = "info";
@Input() icon: string;
@Input() useAlertRole = true;
@Input() showClose = true;
@Output() onClose = new EventEmitter<void>();
ngOnInit(): void {
this.icon ??= defaultIcon[this.bannerType];
}
get bannerClass() {
switch (this.bannerType) {
case "danger":
return "tw-bg-danger-600";
case "info":
return "tw-bg-info-600";
case "premium":
return "tw-bg-success-600";
case "warning":
return "tw-bg-warning-600";
}
}
}