Skip to content

Commit

Permalink
chore(deps-dev): upgrade to Storybook v6 (#362)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
arthurdenner committed Aug 17, 2020
1 parent 4ea6cef commit 4d03f21
Show file tree
Hide file tree
Showing 7 changed files with 2,646 additions and 566 deletions.
3 changes: 0 additions & 3 deletions .storybook/addons.js

This file was deleted.

4 changes: 0 additions & 4 deletions .storybook/config.js

This file was deleted.

4 changes: 4 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
stories: ['../stories/**/*.stories.tsx'],
addons: ['@storybook/addon-knobs'],
};
10 changes: 0 additions & 10 deletions .storybook/webpack.config.js

This file was deleted.

11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "tsdx test --env=jsdom",
"validate": "npm run lint && npm run test -- --coverage && npm run build",
"now-build": "npm run storybook:build",
"storybook": "start-storybook -p 6006",
"storybook": "start-storybook --ci -p 6006",
"storybook:build": "build-storybook"
},
"husky": {
Expand Down Expand Up @@ -45,18 +45,15 @@
},
"devDependencies": {
"@babel/core": "7.11.1",
"@storybook/addon-actions": "5.3.19",
"@storybook/addon-knobs": "5.3.19",
"@storybook/addon-links": "5.3.19",
"@storybook/addons": "5.3.19",
"@storybook/react": "5.3.19",
"@storybook/addon-knobs": "6.0.12",
"@storybook/addons": "6.0.12",
"@storybook/react": "6.0.12",
"@testing-library/jest-dom": "5.11.3",
"@testing-library/react": "10.4.8",
"@testing-library/user-event": "12.1.0",
"@types/jest": "26.0.10",
"@types/storybook__react": "5.2.1",
"autoprefixer": "9.8.6",
"awesome-typescript-loader": "5.2.1",
"babel-loader": "8.1.0",
"cssnano": "4.1.10",
"eslint-plugin-prettier": "3.1.4",
Expand Down
37 changes: 12 additions & 25 deletions stories/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import React from 'react';
import {
withKnobs,
boolean,
date,
number,
select,
text,
} from '@storybook/addon-knobs';
import { storiesOf } from '@storybook/react';
import { boolean, date, number, select, text } from '@storybook/addon-knobs';
import { Form, SemanticICONS } from 'semantic-ui-react';
import 'semantic-ui-css/semantic.min.css';
import SemanticDatepicker from '../src';
Expand All @@ -21,19 +13,14 @@ import {
typeMap,
} from './common';

const stories = storiesOf('Datepickers', module);

stories.addDecorator(withKnobs);
stories.addParameters({
info: {
disable: true,
},
options: {
panelPosition: 'right',
export default {
title: 'Datepickers',
parameters: {
options: { panelPosition: 'right' },
},
});
};

stories.add('Basic usage', () => {
export const basicUsage = () => {
const type = select('Type', typeMap, typeMap.basic);
const inline = boolean('Inline (without input)', false);
const allowOnlyNumbers = boolean('Allow only numbers', false);
Expand Down Expand Up @@ -94,9 +81,9 @@ stories.add('Basic usage', () => {
/>
</Content>
);
});
};

stories.add('With custom icons', () => {
export const withCustomIcons = () => {
const icon = select('Icon (without value)', iconMap, iconMap.calendar);
const clearIcon = select('Clear icon (with value)', iconMap, iconMap.close);
const useCustomIcon = boolean('Custom icon', false);
Expand All @@ -114,9 +101,9 @@ stories.add('With custom icons', () => {
/>
</Content>
);
});
};

stories.add('Usage with Form', () => {
export const usageWithForm = () => {
return (
<Content>
<Form>
Expand All @@ -136,4 +123,4 @@ stories.add('Usage with Form', () => {
</Form>
</Content>
);
});
};

1 comment on commit 4d03f21

@vercel
Copy link

@vercel vercel bot commented on 4d03f21 Aug 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.