Skip to content

Commit da9225a

Browse files
author
Lee Zhen Jie
committed
feat: upgrade storybook
1 parent df18db2 commit da9225a

File tree

448 files changed

+3785
-3874
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

448 files changed

+3785
-3874
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"plugin:@typescript-eslint/recommended",
1313
"plugin:react/recommended",
1414
"plugin:jest/recommended",
15-
"plugin:prettier/recommended"
15+
"plugin:prettier/recommended",
16+
"plugin:storybook/recommended"
1617
],
1718
"rules": {
1819
"@typescript-eslint/no-var-requires": "off",

.storybook/main.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
module.exports = {
2-
core: {
3-
builder: 'webpack5',
4-
},
5-
stories: [
6-
'../src/stories/Introduction.stories.mdx',
7-
'../src/**/*.stories.mdx',
8-
'../src/**/*.stories.@(js|jsx|ts|tsx)',
9-
'./*.stories.mdx',
10-
],
11-
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
2+
stories: ['../src/stories/Introduction.stories.mdx', '../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)', './*.stories.mdx'],
3+
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-mdx-gfm'],
124
features: {
13-
storyStoreV7: true,
5+
storyStoreV7: true
6+
},
7+
framework: {
8+
name: '@storybook/react-webpack5',
9+
options: {}
1410
},
15-
};
11+
docs: {
12+
autodocs: true
13+
}
14+
};

package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99
"node": ">=14"
1010
},
1111
"scripts": {
12-
"build": "npm run build:icon && npm run build:next:icon && npm run build:lib && npm run build:es && npm run build:ts",
12+
"build": "yarn build:icon && yarn build:next:icon && yarn build:lib && yarn build:es && yarn build:ts",
1313
"build:lib": "rm -rf lib && babel src -d lib --extensions .ts,.tsx --ignore .storybook/**/*,src/**/*.test.tsx,src/**/*.test.ts,src/**/*.spec.tsx,src/**/*.spec.ts,src/**/*.stories.tsx",
1414
"build:es": "rm -rf es && cross-env BABEL_ENV=es babel src -d es --extensions .ts,.tsx --ignore .storybook/**/*,src/**/*.test.tsx,src/**/*.test.ts,src/**/*.spec.tsx,src/**/*.spec.ts,src/**/*.stories.tsx",
1515
"build:ts": "tsc --project tsconfig.declaration.json -d --declarationDir lib && tsc --project tsconfig.declaration.json -d --declarationDir es",
16-
"build:icon": "rm -rf src/General/Icon/components && babel-node --extensions .ts,.tsx src/Utils/Icon/generateIcons.ts && npm run format:icon",
16+
"build:icon": "rm -rf src/General/Icon/components && babel-node --extensions .ts,.tsx src/Utils/Icon/generateIcons.ts && yarn format:icon",
1717
"build:next:icon": "npx @svgr/cli --typescript --out-dir src/@next/Icon/components -- src/@next/Icon/icons",
1818
"format:icon": "prettier --write src/General/Icon/components/*.tsx",
1919
"imports": "babel-node --extensions .ts scripts/count-imports/index.ts",
20-
"lint": "npm run lint:css && npm run lint:ts",
20+
"lint": "yarn lint:css && yarn lint:ts",
2121
"lint:css": "stylelint '**/*Style.ts'",
2222
"lint:ts": "eslint '**/*.{ts,tsx}'",
2323
"test:update": "jest --env jsdom -u",
2424
"test": "jest --env jsdom",
2525
"coverage:src": "jest --coverage --collectCoverageFrom 'src/**/*.tsx' --coveragePathIgnorePatterns 'src/General/Icon/components/' --collectCoverageFrom='!src/**/*.stories.tsx' --collectCoverageFrom='!src/**/*StoryStyle.tsx' --collectCoverageFrom='!src/**/*StoriesHelpers.tsx' --collectCoverageFrom='!src/stories/story-components/**'",
26-
"storybook": "start-storybook -p 6006",
27-
"storybook:build": "rm -rf .out && npm run storybook:build:assets && npm run build:icon && npm run build:next:icon && build-storybook -o .out -s dist/public",
28-
"storybook:build:test": "rm -rf storybook-static && npm run storybook:build:assets && npm run build:icon && npm run build:next:icon && build-storybook -o storybook-static -s dist/public",
26+
"storybook": "storybook dev -p 6006",
27+
"storybook:build": "rm -rf .out && yarn storybook:build:assets && yarn build:icon && yarn build:next:icon && sb build -o .out -s dist/public",
28+
"storybook:build:test": "rm -rf storybook-static && yarn storybook:build:assets && yarn build:icon && yarn build:next:icon && storybook build -o storybook-static -s dist/public",
2929
"storybook:build:assets": "webpack",
3030
"prepare": "husky install",
3131
"check-definition-files": "node checkDefinitionFiles.js"
@@ -59,12 +59,12 @@
5959
"@babel/preset-react": "^7.18.6",
6060
"@babel/preset-typescript": "^7.18.6",
6161
"@playwright/test": "^1.29.0",
62-
"@storybook/addon-actions": "^6.5.15",
63-
"@storybook/addon-essentials": "^6.5.15",
64-
"@storybook/addon-links": "^6.5.15",
65-
"@storybook/builder-webpack5": "^6.5.15",
66-
"@storybook/manager-webpack5": "^6.5.15",
67-
"@storybook/react": "^6.5.15",
62+
"@storybook/addon-actions": "^7.0.26",
63+
"@storybook/addon-essentials": "^7.0.26",
64+
"@storybook/addon-links": "^7.0.26",
65+
"@storybook/addon-mdx-gfm": "^7.0.26",
66+
"@storybook/react": "^7.0.26",
67+
"@storybook/react-webpack5": "^7.0.26",
6868
"@svgr/cli": "^6.5.1",
6969
"@testing-library/dom": "^8.11.3",
7070
"@testing-library/jest-dom": "^5.16.2",
@@ -100,6 +100,7 @@
100100
"eslint-plugin-prettier": "^3.1.1",
101101
"eslint-plugin-react": "^7.27.1",
102102
"eslint-plugin-react-hooks": "^4.3.0",
103+
"eslint-plugin-storybook": "^0.6.12",
103104
"file-loader": "^6.2.0",
104105
"fork-ts-checker-webpack-plugin": "^1.3.4",
105106
"generate-changelog": "^1.7.1",
@@ -117,6 +118,7 @@
117118
"react-is": "^17.0.2",
118119
"react-test-renderer": "^17.0.2",
119120
"start-server-and-test": "^1.15.2",
121+
"storybook": "^7.0.26",
120122
"styled-components": "^5.1.1",
121123
"stylelint": "^10.0.1",
122124
"stylelint-config-recommended": "^2.2.0",

src/@next/Bar/Bar.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ const customActionGroupTemplate: Story<BarProps> = args => {
217217
);
218218
};
219219

220-
export const customActionGroup = customActionGroupTemplate.bind({});
221-
customActionGroup.parameters = {
220+
export const CustomActionGroup = customActionGroupTemplate.bind({});
221+
CustomActionGroup.parameters = {
222222
docs: {
223223
source: {
224224
code: `
225-
const customActionGroup = (
225+
const CustomActionGroup = (
226226
<>
227227
<PopoverMenu
228228
title="Select"
@@ -238,7 +238,7 @@ customActionGroup.parameters = {
238238
{...args}
239239
heading={'Page Title 2'}
240240
subheading={'Additional Content'}
241-
customActionGroup={customActionGroup}
241+
customActionGroup={CustomActionGroup}
242242
/>
243243
);
244244
`,

src/@next/Divider/Divider.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta, Story } from '@storybook/react';
1+
import { Meta } from '@storybook/react';
22
import React from 'react';
33

44
import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
@@ -12,7 +12,7 @@ export default {
1212
decorators: [Story => <BaseContainer>{Story()}</BaseContainer>],
1313
} as Meta;
1414

15-
const Template: Story<void> = () => (
15+
const Template = () => (
1616
<div>
1717
some text
1818
<Divider />

src/@next/Modal/Modal.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Interactive.args = {
7575
showCloseButton: true,
7676
};
7777

78-
const WithLargeContentTemplate: Story<void> = () => {
78+
const WithLargeContentTemplate = () => {
7979
const [iOpen, setOpen] = useState(false);
8080

8181
useEffect(() => {
@@ -117,7 +117,7 @@ const WithLargeContentTemplate: Story<void> = () => {
117117
export const WithLargeContent = WithLargeContentTemplate.bind({});
118118
WithLargeContent.args = {};
119119

120-
const WithOverlflowContentTemplate: Story<void> = () => {
120+
const WithOverlflowContentTemplate = () => {
121121
const [iOpen, setOpen] = useState(false);
122122

123123
useEffect(() => {
@@ -376,7 +376,7 @@ WithLockedScrollableBackdrop.args = {
376376
showCloseButton: true,
377377
};
378378

379-
const WithSpinnerTemplate: Story<void> = () => {
379+
const WithSpinnerTemplate = () => {
380380
const [iOpen, setOpen] = useState(false);
381381

382382
useEffect(() => {
@@ -406,7 +406,7 @@ const WithSpinnerTemplate: Story<void> = () => {
406406
export const WithSpinner = WithSpinnerTemplate.bind({});
407407
WithSpinner.args = {};
408408

409-
const WithCustomActionsTemplate: Story<void> = () => {
409+
const WithCustomActionsTemplate = () => {
410410
const [showModal, setShowModal] = useState(false);
411411
const triggerAlert = () => {
412412
setShowModal(true);
@@ -442,7 +442,7 @@ const WithCustomActionsTemplate: Story<void> = () => {
442442
export const WithCustomActions = WithCustomActionsTemplate.bind({});
443443
WithCustomActions.args = {};
444444

445-
const WithNumberInputAndTooltipTemplate: Story<void> = () => {
445+
const WithNumberInputAndTooltipTemplate = () => {
446446
const [showModal, setShowModal] = useState(false);
447447
const triggerAlert = () => {
448448
setShowModal(true);

src/@next/Modal/ModalWithProvider.stories.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Meta, Story } from '@storybook/react';
1+
import { Meta } from '@storybook/react';
22
import React from 'react';
33

4-
import { Button } from '../Button';
5-
import { useModal } from './useModal';
6-
import { ModalWithProvider } from './ModalWithProvider';
74
import {
85
withGlintsPortalContainer,
96
withModalProvider,
107
} from '../../helpers/storybook/Decorators';
8+
import { Button } from '../Button';
119
import { space16 } from '../utilities/spacing';
10+
import { ModalWithProvider } from './ModalWithProvider';
11+
import { useModal } from './useModal';
1212

1313
(ModalWithProvider as React.FunctionComponent<void>).displayName =
1414
'ModalWithProvider';
@@ -18,7 +18,7 @@ export default {
1818
component: ModalWithProvider,
1919
} as Meta;
2020

21-
const Template: Story<void> = () => {
21+
const Template = () => {
2222
const { open: showModal } = useModal();
2323

2424
const primaryAction = {
@@ -106,7 +106,7 @@ Interactive.parameters = {
106106
},
107107
};
108108

109-
const WithLockedScrollableBackdropTemplate: Story<void> = () => {
109+
const WithLockedScrollableBackdropTemplate = () => {
110110
const { open: showModal } = useModal();
111111

112112
const primaryAction = {

src/General/Divider/Divider.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Template: Story<Props> = args => <Divider {...args} />;
1414

1515
export const Interactive = Template.bind({});
1616

17-
export const dividerWithGreyTheme = Template.bind({});
18-
dividerWithGreyTheme.args = {
17+
export const DividerWithGreyTheme = Template.bind({});
18+
DividerWithGreyTheme.args = {
1919
theme: 'grey',
2020
};

src/Input/Textarea/Textarea.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Interactive.args = {
1717
label: 'Description',
1818
};
1919

20-
export const removeFloatingLabelIsTrue = Template.bind({});
21-
removeFloatingLabelIsTrue.args = {
20+
export const RemoveFloatingLabelIsTrue = Template.bind({});
21+
RemoveFloatingLabelIsTrue.args = {
2222
label: 'Remove Floating Label Is True',
2323
removeFloatingLabel: true,
2424
};

src/stories/Introduction.stories.mdx

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)