Skip to content

Commit 4d03f21

Browse files
authored
chore(deps-dev): upgrade to Storybook v6 (#362)
* chore(deps): upgrade Storybook dependencies to v6 * refactor(stories): update stories to Component Story Format (CSF) * refactor(stories): update to zero-config TypeScript setup with main.js * refactor(stories): remove unused addons and useless configuration * chore(stories): configure panel to be on the right
1 parent 4ea6cef commit 4d03f21

File tree

7 files changed

+2646
-566
lines changed

7 files changed

+2646
-566
lines changed

.storybook/addons.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

.storybook/config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

.storybook/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
stories: ['../stories/**/*.stories.tsx'],
3+
addons: ['@storybook/addon-knobs'],
4+
};

.storybook/webpack.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test": "tsdx test --env=jsdom",
1515
"validate": "npm run lint && npm run test -- --coverage && npm run build",
1616
"now-build": "npm run storybook:build",
17-
"storybook": "start-storybook -p 6006",
17+
"storybook": "start-storybook --ci -p 6006",
1818
"storybook:build": "build-storybook"
1919
},
2020
"husky": {
@@ -45,18 +45,15 @@
4545
},
4646
"devDependencies": {
4747
"@babel/core": "7.11.1",
48-
"@storybook/addon-actions": "5.3.19",
49-
"@storybook/addon-knobs": "5.3.19",
50-
"@storybook/addon-links": "5.3.19",
51-
"@storybook/addons": "5.3.19",
52-
"@storybook/react": "5.3.19",
48+
"@storybook/addon-knobs": "6.0.12",
49+
"@storybook/addons": "6.0.12",
50+
"@storybook/react": "6.0.12",
5351
"@testing-library/jest-dom": "5.11.3",
5452
"@testing-library/react": "10.4.8",
5553
"@testing-library/user-event": "12.1.0",
5654
"@types/jest": "26.0.10",
5755
"@types/storybook__react": "5.2.1",
5856
"autoprefixer": "9.8.6",
59-
"awesome-typescript-loader": "5.2.1",
6057
"babel-loader": "8.1.0",
6158
"cssnano": "4.1.10",
6259
"eslint-plugin-prettier": "3.1.4",

stories/index.stories.tsx

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import React from 'react';
2-
import {
3-
withKnobs,
4-
boolean,
5-
date,
6-
number,
7-
select,
8-
text,
9-
} from '@storybook/addon-knobs';
10-
import { storiesOf } from '@storybook/react';
2+
import { boolean, date, number, select, text } from '@storybook/addon-knobs';
113
import { Form, SemanticICONS } from 'semantic-ui-react';
124
import 'semantic-ui-css/semantic.min.css';
135
import SemanticDatepicker from '../src';
@@ -21,19 +13,14 @@ import {
2113
typeMap,
2214
} from './common';
2315

24-
const stories = storiesOf('Datepickers', module);
25-
26-
stories.addDecorator(withKnobs);
27-
stories.addParameters({
28-
info: {
29-
disable: true,
30-
},
31-
options: {
32-
panelPosition: 'right',
16+
export default {
17+
title: 'Datepickers',
18+
parameters: {
19+
options: { panelPosition: 'right' },
3320
},
34-
});
21+
};
3522

36-
stories.add('Basic usage', () => {
23+
export const basicUsage = () => {
3724
const type = select('Type', typeMap, typeMap.basic);
3825
const inline = boolean('Inline (without input)', false);
3926
const allowOnlyNumbers = boolean('Allow only numbers', false);
@@ -94,9 +81,9 @@ stories.add('Basic usage', () => {
9481
/>
9582
</Content>
9683
);
97-
});
84+
};
9885

99-
stories.add('With custom icons', () => {
86+
export const withCustomIcons = () => {
10087
const icon = select('Icon (without value)', iconMap, iconMap.calendar);
10188
const clearIcon = select('Clear icon (with value)', iconMap, iconMap.close);
10289
const useCustomIcon = boolean('Custom icon', false);
@@ -114,9 +101,9 @@ stories.add('With custom icons', () => {
114101
/>
115102
</Content>
116103
);
117-
});
104+
};
118105

119-
stories.add('Usage with Form', () => {
106+
export const usageWithForm = () => {
120107
return (
121108
<Content>
122109
<Form>
@@ -136,4 +123,4 @@ stories.add('Usage with Form', () => {
136123
</Form>
137124
</Content>
138125
);
139-
});
126+
};

0 commit comments

Comments
 (0)