mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 01:03:35 +00:00
[CL-18] toast component and service (#6490)
Update toast styles and new service to CL.
This commit is contained in:
39
libs/components/src/toast/toast.module.ts
Normal file
39
libs/components/src/toast/toast.module.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { ModuleWithProviders, NgModule } from "@angular/core";
|
||||
import { DefaultNoComponentGlobalConfig, GlobalConfig, TOAST_CONFIG } from "ngx-toastr";
|
||||
|
||||
import { ToastComponent } from "./toast.component";
|
||||
import { BitwardenToastrComponent } from "./toastr.component";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, ToastComponent],
|
||||
declarations: [BitwardenToastrComponent],
|
||||
exports: [BitwardenToastrComponent],
|
||||
})
|
||||
export class ToastModule {
|
||||
static forRoot(config: Partial<GlobalConfig> = {}): ModuleWithProviders<ToastModule> {
|
||||
return {
|
||||
ngModule: ToastModule,
|
||||
providers: [
|
||||
{
|
||||
provide: TOAST_CONFIG,
|
||||
useValue: {
|
||||
default: BitwardenToastrGlobalConfig,
|
||||
config: config,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export const BitwardenToastrGlobalConfig: GlobalConfig = {
|
||||
...DefaultNoComponentGlobalConfig,
|
||||
toastComponent: BitwardenToastrComponent,
|
||||
tapToDismiss: false,
|
||||
timeOut: 5000,
|
||||
extendedTimeOut: 2000,
|
||||
maxOpened: 5,
|
||||
autoDismiss: true,
|
||||
progressBar: true,
|
||||
};
|
||||
Reference in New Issue
Block a user