Skip to content

Commit 2be4107

Browse files
authored
Merge pull request #373 from lyjeileen/upgrade
fix: upgrade storybook to v9
2 parents 73ab1ef + 33526fe commit 2be4107

37 files changed

+655
-814
lines changed

.storybook/addons/button/githubButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Button } from '@storybook/components'
21
import { GithubIcon } from '@storybook/icons'
3-
import { addons, types } from '@storybook/manager-api'
42
import React from 'react'
3+
import { Button } from 'storybook/internal/components'
4+
import { addons, types } from 'storybook/manager-api'
55

66
const ADDON_ID = 'github-link'
77
const TOOL_ID = `${ADDON_ID}/tool`

.storybook/addons/button/logo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addons } from '@storybook/manager-api'
1+
import { addons } from 'storybook/manager-api'
22

33
const logoDataAttribute = 'data-storybook-logo-id'
44
const logoId = 'storybook-sidebar-custom-logo'

.storybook/addons/button/viewSourceButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Button } from '@storybook/components'
2-
import { addons, type API, types } from '@storybook/manager-api'
31
import React, { useEffect, useState } from 'react'
2+
import { Button } from 'storybook/internal/components'
43
import type { API_LeafEntry } from 'storybook/internal/types'
4+
import { addons, type API, types } from 'storybook/manager-api'
55

66
const ADDON_ID = 'github-source-link'
77
const TOOL_ID = `${ADDON_ID}/tool`

.storybook/main.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
/* eslint-disable storybook/no-uninstalled-addons */
21
import type { StorybookConfig } from '@storybook/react-webpack5'
32
import path from 'path'
43

54
const config: StorybookConfig = {
65
stories: ['../src/**/*.stories.@(tsx)', '../docs/*.mdx'],
6+
77
addons: [
8-
'@storybook/addon-toolbars',
9-
'@storybook/addon-viewport',
108
'storybook-addon-mock',
119
{
1210
name: '@storybook/addon-docs',
@@ -19,9 +17,6 @@ const config: StorybookConfig = {
1917
name: '@storybook/react-webpack5',
2018
options: {},
2119
},
22-
docs: {
23-
autodocs: 'tag',
24-
},
2520
typescript: {
2621
// Overrides the default Typescript configuration to allow multi-package components to be documented via Autodocs.
2722
reactDocgen: 'react-docgen',

.storybook/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import './addons/button/logo.tsx'
22

3-
import { addons } from '@storybook/manager-api'
3+
import { addons } from 'storybook/manager-api'
44

55
import rusticTheme from './rusticTheme'
66

.storybook/preview.js renamed to .storybook/preview.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'
2-
import { CssBaseline, ThemeProvider } from '@mui/material'
1+
import { ThemeProvider } from '@mui/material'
2+
import CssBaseline from '@mui/material/CssBaseline'
33
import { StyledEngineProvider } from '@mui/material/styles'
44
import {
5-
Title,
6-
Subtitle,
5+
ArgTypes,
76
Description,
87
Primary,
9-
ArgTypes,
108
Stories,
11-
} from '@storybook/blocks'
12-
import { rusticLightTheme, rusticDarkTheme } from '../src/rusticTheme'
13-
9+
Subtitle,
10+
Title,
11+
} from '@storybook/addon-docs/blocks'
12+
import type { StoryContext, StoryFn } from '@storybook/react-webpack5'
1413
import React from 'react'
14+
import { INITIAL_VIEWPORTS } from 'storybook/viewport'
15+
16+
import { rusticDarkTheme, rusticLightTheme } from '../src/rusticTheme'
1517

1618
export const globalTypes = {
1719
theme: {
@@ -27,7 +29,7 @@ export const globalTypes = {
2729
},
2830
}
2931

30-
const withMuiTheme = (Story, context) => {
32+
const withMuiTheme = (Story: StoryFn, context: StoryContext) => {
3133
const theme =
3234
context.globals.theme === 'light' ? rusticLightTheme : rusticDarkTheme
3335

@@ -90,11 +92,11 @@ const preview = {
9092
},
9193
}
9294

93-
export const webpackFinal = async (config) => {
95+
export const webpackFinal = async (config: any) => {
9496
config.module.rules.push({
9597
test: /\.css$/,
9698
use: ['style-loader', 'css-loader'],
97-
include: path.resolve(__dirname, '../'),
99+
include: '../',
98100
})
99101

100102
config.module.rules.push({

.storybook/rusticTheme.js renamed to .storybook/rusticTheme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { create } from '@storybook/theming/create'
1+
import { create } from 'storybook/theming'
22

33
export default create({
44
base: 'light',

docs/quickStart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Source, Meta } from '@storybook/addon-docs'
1+
import { Source, Meta } from '@storybook/addon-docs/blocks'
22

33
<Meta title="Documentation/Quick Start" />
44

docs/theme.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Source, Meta } from '@storybook/addon-docs'
1+
import { Source, Meta } from '@storybook/addon-docs/blocks'
22

33
<Meta title="Documentation/Theme And Styling" />
44

docs/troubleshooting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Source, Meta } from '@storybook/addon-docs'
1+
import { Source, Meta } from '@storybook/addon-docs/blocks'
22

33
<Meta title="Documentation/Troubleshooting" />
44

0 commit comments

Comments
 (0)