aboutsummaryrefslogtreecommitdiffstats
path: root/stories/angular/notifications.stories.ts
blob: 4e875177845b7a0579ee4b167959d5b667358f40 (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
import { storiesOf } from '@storybook/angular';
import { withKnobs, text, number, boolean, array, select, color, date, button } from '@storybook/addon-knobs';
import { withNotes } from '@storybook/addon-notes';
import { action, configureActions } from '@storybook/addon-actions';
import { moduleMetadata } from '@storybook/angular';
import { NotificationModule } from '../../src/angular/notifications/notification.module';
import { NotificationSettings } from '../../src/angular/notifications/utilities/notification.config';

let stories = storiesOf('Notification', module)
  .addDecorator(withKnobs)
  .addDecorator(withNotes)
  .addDecorator(
    moduleMetadata({
      declarations: [
      ],
      imports: [
        NotificationModule
         
      ]
    })
  )
  createStory(stories, "All options", true, true, "Notification", "Full example of simple tabs.");
  // createStory(stories, "Tabs with text", true, false, "Tabs with titles", "Simple tabs with text title.");
  // createStory(stories, "Tabs with icons", false, true, "Tabs with icons", "Simple tabs with icon title.");

  function createStory(stories, title, containsTitle, containsTitleIcon, notesTitle, notesText){
    stories.add(title, () => {
        const _type =  select('Type', ["info", "warning", "error", "success"], 'left', '');
        const _notifyText = text('Text','notif info message test');
        const _notifyTitle = text('Title', 'Notif Titile Info');
        const _sticky = boolean('Sticky', false);
        const _hasCustomContent = boolean('Has customer content', false);
        const _duration = number('Duration', 2000);
        let _notificationSetting = new NotificationSettings(_type, _notifyText, _notifyTitle, _duration, _sticky, _hasCustomContent)
        // const innerComponentType: Type<any>;
        // const innerComponentOptions: any;
        

        return {
            props: {
                selectTab: action('select tab changed'),
                _type, _notifyText, _notifyTitle, _sticky, _hasCustomContent, _duration
            },
            template: `
            <sdc-notification
               [notificationSetting] = "_notificationSetting"
            >
            </sdc-notification>
            `
        }
        },
        { notes: `<h2>` + notesTitle + `</h2>` + notesText + `<br>Use the KNOBS tab to change values.`
        }
    )
  }