Skip to content

Commit f85daad

Browse files
authored
Merge pull request #515 from PayButton/chore/update-react-and-storybook
chore: fix Storybook issue by updating React and Storybook to v7.x
2 parents 55585ae + d1207ca commit f85daad

File tree

6 files changed

+30560
-45577
lines changed

6 files changed

+30560
-45577
lines changed

react/.storybook/main.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
module.exports = {
2-
"stories": [
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
3+
const config: StorybookConfig = {
4+
stories: [
35
"../lib/**/*.stories.mdx",
46
"../lib/**/*.stories.@(js|jsx|ts|tsx)"
57
],
6-
"addons": [
8+
addons: [
79
"@storybook/addon-links",
810
"@storybook/addon-essentials",
911
"@storybook/addon-a11y",
10-
"@storybook/preset-create-react-app",
11-
]
12-
};
12+
],
13+
framework: {
14+
name: "@storybook/react-vite",
15+
options: {},
16+
},
17+
docs: {
18+
autodocs: "tag",
19+
},
20+
};
21+
22+
export default config;

react/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM node:16-alpine
33
WORKDIR /app
44

55
COPY package*.json ./
6-
RUN yarn install && yarn build --ignore-scripts
6+
RUN npm install
77
COPY . .
88

9-
CMD chown node: -R node_modules && yarn storybook
9+
CMD chown node: -R node_modules && npm run storybook
1010

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

44
import { ThemeName } from '../../themes';
5-
import Button, { ButtonProps } from './Button';
5+
import Button from './Button';
66

7-
export default {
7+
const meta: Meta<typeof Button> = {
88
title: 'Button',
99
component: Button,
1010
decorators: [
11-
(Story: Story): React.ReactNode => (
11+
(Story) => (
1212
<div style={{ margin: 'auto', maxWidth: 400 }}>
1313
<Story />
1414
</div>
@@ -22,13 +22,16 @@ export default {
2222
},
2323
};
2424

25-
const Template: Story<ButtonProps> = props => <Button {...props} />;
25+
export default meta;
26+
type Story = StoryObj<typeof meta>;
2627

27-
export const Default = Template.bind({});
28-
Default.args = {};
28+
export const Default: Story = {
29+
args: {},
30+
};
2931

30-
export const OrangeTheme = Template.bind({});
31-
OrangeTheme.args = {
32-
theme: ThemeName.ORANGE,
33-
animation: 'invert',
32+
export const OrangeTheme: Story = {
33+
args: {
34+
theme: ThemeName.ORANGE,
35+
animation: 'invert',
36+
},
3437
};

0 commit comments

Comments
 (0)