0.1.5 • Published 9 months ago

winwin-notifications v0.1.5

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

WinwinNotifications

This library allows to show floating notifications with cancel btn

Installing

npm i winwin-notifications

In app.module.ts do import

import {WinWinNotificationsModule} from "winwin-notifications";
...
imports: [
    ...,
    WinWinNotificationsModule,
    ...
]

Then in your HTML insert component. You should use wrapper to style default and custom notifications

<div class="wrapper">
  <lib-winwin-notifications></lib-winwin-notifications>
</div>

And in component.ts file inject

    constructor(private _notificationService: WinWinNotificationsService) {}

Usage

There is several methods to call notification

1. Usual notification.

  this._notificationService.open(message: string, timeout: number, className: string);

You can customize style with next construction

.wrapper ::ng-deep .className {
 background: yellow;
}

2. Notification with custom component

    this._notificationService.openFromComponent(component: ComponentType<any>, timeout: number, className: string);

You can implement close button in your component

@Component({
  selector: 'app-custom-notification',
  template: `
    <div class="custom-notification">
      <p>Notification message</p>
      <button (click)="closeNotification()">CLOSE</button>
    </div>
  `,
  ...
})
export class CustomNotificationComponent() {

    @Output() dismiss = new EventEmitter(); // should be named 'dismiss' only

    constructor(){}
    ...

    public closeNotification(): void {
      this.dismiss.emit();
    }

}

Further help

Please call @KubasNinjs telegram for extras

0.1.5

9 months ago

0.1.4

2 years ago

0.1.3

2 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago