/
config.js
81 lines (65 loc) · 2.39 KB
/
config.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React from 'react';
if (process.env.NODE_ENV !== 'production') {
const whyDidYouRender = require('@welldone-software/why-did-you-render');
whyDidYouRender(React);
}
import moment from 'moment';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
import { configure, addDecorator, setAddon } from '@storybook/react';
import infoAddon from '@storybook/addon-info';
import { setOptions } from '@storybook/addon-options';
import registerInterfaceWithDefaultTheme from '../src/utils/registerInterfaceWithDefaultTheme';
import '../css/storybook.scss';
registerInterfaceWithDefaultTheme(aphroditeInterface);
addDecorator((story) => {
moment.locale('en');
return story();
});
function getLink(href, text) {
return `<a href=${href} rel="noopener noreferrer" target="_blank">${text}</a>`;
}
const README = getLink('https://github.com/react-dates/react-dates/blob/HEAD/README.md', 'README');
const wrapperSource = getLink('https://github.com/react-dates/react-dates/tree/HEAD/examples', 'wrapper source');
const helperText = `All examples are built using a wrapper component that is not exported by
react-dates. Please see the ${README} for more information about minimal setup or explore
the ${wrapperSource} to see how to integrate react-dates into your own app.`;
addDecorator(story => (
<div>
<div
style={{
background: '#fff',
height: 6 * 8,
width: '100%',
position: 'fixed',
top: 0,
left: 0,
padding: '8px 40px 8px 8px',
overflow: 'scroll',
}}
dangerouslySetInnerHTML={{ __html: helperText }}
/>
<div style={{ marginTop: 7 * 8 }}>
{story()}
</div>
</div>
));
setOptions({
name: 'REACT-DATES',
url: 'https://github.com/react-dates/react-dates',
});
function loadStories() {
require('../stories/DateRangePicker');
require('../stories/DateRangePicker_input');
require('../stories/DateRangePicker_calendar');
require('../stories/DateRangePicker_day');
require('../stories/SingleDatePicker');
require('../stories/SingleDatePicker_input');
require('../stories/SingleDatePicker_calendar');
require('../stories/SingleDatePicker_day');
require('../stories/DayPickerRangeController');
require('../stories/DayPickerSingleDateController');
require('../stories/DayPicker');
require('../stories/PresetDateRangePicker');
}
setAddon(infoAddon);
configure(loadStories, module);