Skip to content

Commit

Permalink
feat(toastr): remove deprecated iconPack property (#2620)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
`NbToastrConfig.iconPack` property removed. You can set icon pack via `icon` property:
```
const toastrConfig = {
  // ...
  icon: { icon: 'star', pack: 'eva' },
}
```

`NbToastComponent.iconPack` and `NbToastComponent.iconConfig` properties removed.
Use `icon` property instead.
  • Loading branch information
yggg committed Dec 16, 2020
1 parent 32ab00e commit 77a3519
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion src/framework/theme/components/toastr/toast.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="icon-container" *ngIf="hasIcon && icon">
<nb-icon [config]="iconConfig"></nb-icon>
<nb-icon [config]="icon"></nb-icon>
</div>
<div class="content-container">
<span class="title subtitle">{{ toast.title }}</span>
Expand Down
25 changes: 0 additions & 25 deletions src/framework/theme/components/toastr/toast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,31 +157,6 @@ export class NbToastComponent implements OnInit {
return this.toast.config.icon;
}

/* @deprecated Use pack property of icon config */
get iconPack(): string {
return this.toast.config.iconPack;
}

/*
@breaking-change 5 remove
@deprecated
*/
get iconConfig(): NbIconConfig {
const toastConfig = this.toast.config;
const isIconName = typeof this.icon === 'string';

if (!isIconName) {
return toastConfig.icon as NbIconConfig;
}

const iconConfig: NbIconConfig = { icon: toastConfig.icon as string };
if (toastConfig.iconPack) {
iconConfig.pack = toastConfig.iconPack;
}

return iconConfig;
}

@HostListener('click')
onClick() {
this.destroy.emit();
Expand Down
6 changes: 0 additions & 6 deletions src/framework/theme/components/toastr/toastr-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ export class NbToastrConfig {
* Icon name or icon config object that can be provided to render custom icon.
* */
icon: string | NbIconConfig = 'email';
/**
* Icon pack to look for the icon in.
* @deprecated Set pack via icon config object passed to icon property
* @breaking-change 5.0.0
* */
iconPack: string;
/**
* Toast status icon-class mapping.
* */
Expand Down

0 comments on commit 77a3519

Please sign in to comment.