1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

[CL-135] Migrate component library to standalone components (#12389)

* Migrate component library to standalone components

* Fix tests
This commit is contained in:
Oscar Hinton
2024-12-17 23:29:48 +01:00
committed by GitHub
parent ac13cf7ce6
commit 5a582dfc6f
101 changed files with 330 additions and 216 deletions

View File

@@ -2,7 +2,6 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { SharedModule } from "../shared/shared.module";
import { I18nMockService } from "../utils/i18n-mock.service";
import { BannerComponent } from "./banner.component";
@@ -13,8 +12,7 @@ describe("BannerComponent", () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SharedModule],
declarations: [BannerComponent],
imports: [BannerComponent],
providers: [
{
provide: I18nService,

View File

@@ -1,7 +1,11 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { CommonModule } from "@angular/common";
import { Component, Input, OnInit, Output, EventEmitter } from "@angular/core";
import { IconButtonModule } from "../icon-button";
import { I18nPipe } from "../shared/i18n.pipe";
type BannerTypes = "premium" | "info" | "warning" | "danger";
const defaultIcon: Record<BannerTypes, string> = {
@@ -14,6 +18,8 @@ const defaultIcon: Record<BannerTypes, string> = {
@Component({
selector: "bit-banner",
templateUrl: "./banner.component.html",
standalone: true,
imports: [CommonModule, IconButtonModule, I18nPipe],
})
export class BannerComponent implements OnInit {
@Input("bannerType") bannerType: BannerTypes = "info";

View File

@@ -1,14 +1,9 @@
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";
import { IconButtonModule } from "../icon-button";
import { SharedModule } from "../shared/shared.module";
import { BannerComponent } from "./banner.component";
@NgModule({
imports: [CommonModule, SharedModule, IconButtonModule],
imports: [BannerComponent],
exports: [BannerComponent],
declarations: [BannerComponent],
})
export class BannerModule {}