UNPKG

3.11 kBJavaScriptView Raw
1import React from 'react';
2
3import Johnson from '../src/index';
4import {addStory} from './config';
5
6addStory('no events', props => (
7 <Johnson
8 {...props}
9 initialData={{
10 ...props.initialData,
11 events: [],
12 }}
13 />
14));
15
16addStory('mixed events', props => (
17 <Johnson {...props} />
18));
19
20addStory('helium default', props => (
21 <Johnson
22 {...props}
23 initialData={{
24 ...props.initialData,
25 events: props.initialData.events.filter(event => event.story === 'helium2'),
26 }}
27 />
28));
29
30addStory('helium read only', props => (
31 <Johnson
32 {...props}
33 initialData={{
34 ...props.initialData,
35 events: props.initialData.events.filter(event => event.story === 'helium1'),
36 }}
37 />
38));
39
40addStory('helium success', props => (
41 <Johnson
42 {...props}
43 initialData={{
44 ...props.initialData,
45 events: props.initialData.events.filter(event => event.story === 'heliumSuccess'),
46 }}
47 />
48));
49
50addStory('helium mixed', props => (
51 <Johnson
52 {...props}
53 initialData={{
54 ...props.initialData,
55 events: props.initialData.events.filter(event => event.templateContext),
56 }}
57 />
58));
59
60addStory('checks incomplete', props => (
61 <Johnson
62 {...props}
63 initialData={{
64 ...props.initialData,
65 checksComplete: false,
66 }}
67 />
68));
69
70addStory('dismissibles only', props => (
71 <Johnson
72 {...props}
73 initialData={{
74 ...props.initialData,
75 events: props.initialData.events.filter(event => event.dismissible),
76 }}
77 />
78));
79
80addStory('non-dismissible warnings only', props => (
81 <Johnson
82 {...props}
83 initialData={{
84 ...props.initialData,
85 events: props.initialData.events.map(event => ({
86 ...event,
87 dismissible: false,
88 level: 'warning',
89 })),
90 }}
91 />
92));
93
94addStory('dismissibles only, but can not authorise users', props => (
95 <Johnson
96 {...props}
97 initialData={{
98 ...props.initialData,
99 events: props.initialData.events.filter(event => event.dismissible),
100 canAuthoriseUsers: false,
101 }}
102 />
103));
104
105addStory('errors present, but hidden', props => (
106 <Johnson
107 {...props}
108 initialData={{
109 ...props.initialData,
110 events: undefined,
111 errorsPresentButHidden: true,
112 }}
113 />
114));
115
116addStory('old style events', props => (
117 <Johnson
118 {...props}
119 initialData={{
120 ...props.initialData,
121 events: props.initialData.events
122 .filter(event => event.title)
123 .map(event => ({
124 ...event,
125 date: '2019-08-22 16:15:26',
126 exception: 'I\'m not sure what should be here',
127 old: true,
128 })),
129 }}
130 />
131));
132
133addStory('new and old style events', props => (
134 <Johnson
135 {...props}
136 initialData={{
137 ...props.initialData,
138 events: [
139 ...props.initialData.events,
140 ...props.initialData.events
141 .filter(event => event.title)
142 .map(event => ({
143 ...event,
144 date: '2019-08-22 16:15:26',
145 exception: 'I\'m not sure what should be here',
146 old: true,
147 })),
148 ],
149 }}
150 />
151));