aboutsummaryrefslogtreecommitdiffstats
path: root/stories/ng2-component-lab/components/notifications-example.component.ts
blob: 91dd95e0b86cdb10433d94b04fa156e3aa03fa15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { Component, Input, ViewChild } from "@angular/core";
import { NotificationsService } from "../../../src/angular/notifications/services/notifications.service";
import { NotificationSettings } from "../../../src/angular/notifications/utilities/notification.config";
import { InnerNotifContent } from "../../../src/angular/notifications/notification-inner-content-example.component";

@Component({
    selector: "notifications-example",
    template: `
       <div>
           <span>Send Success Notification</span>
           <sdc-button (click)="sendSuccessNotif()" text="Click Me!"></sdc-button>
       </div>
       <div>
           <span>Send Warning Notification</span>
           <sdc-button (click)="sendWarnNotif()" text="Click Me!"></sdc-button>
       </div>
       <div>
           <span>Send Info Notification</span>
           <sdc-button (click)="sendInfoNotif()" text="Click Me!"></sdc-button>
       </div>
       <div>
           <span>Send Success MultipleLine Notification</span>
           <sdc-button (click)="sendMultipleLinesSuceessNotif()" text="Click Me!"></sdc-button>
       </div>
       <div>
           <span>Send Success Custom Notification</span>
           <sdc-button (click)="sendSuccessCustomNotif()" text="Click Me!"></sdc-button>
       </div>
       <sdc-notification-container>
        </sdc-notification-container>
`
})
export class NotificationsExample {

    constructor(private notifsService : NotificationsService) {
    }

    sendSuccessNotif() {
        this.notifsService.push(new NotificationSettings("success", 'notif success message test', 'Notif Title Success'));
    }

    sendMultipleLinesSuceessNotif() {
        this.notifsService.push(new NotificationSettings("success", 'notif success message test with a lot of test so we can test multiple line case lets just add blabla bcdesfg hijklmnop qrstuvw xyz abcdesfg hijklmnop qrstuvw xyz', 'Notif Title Success'));
    }

    sendWarnNotif() {
        this.notifsService.push(new NotificationSettings("warn", 'notif warn message test', 'Notif Title Warn'));
    }

    sendInfoNotif() {
        this.notifsService.push(new NotificationSettings("info", 'notif info message test', 'Notif Title Info'));
    }

    sendSuccessCustomNotif() {
        this.notifsService.push(new NotificationSettings( "info", 'notif XYZ', 'Notif Custom XYZ', 10000, false, true, InnerNotifContent, { notifyText : "notif info custom inner message test", notifyTitle : "Notif Custom Inner Title Info"}));
    }
}