Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Storybook to v7 #3744

Merged
merged 16 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion webview/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import webpack from 'webpack'
import webpackConfig from '../webpack.config'

export default {
reactOptions: { fastRefresh: true },
framework: {
name: '@storybook/react-webpack5',
options: {}
},
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['../../extension/src/test/fixtures/plotsDiff/staticImages'],
addons: [
'storybook-addon-themes',
'storybook-addon-designs',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
{
Expand Down
19 changes: 10 additions & 9 deletions webview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"dev": "webpack watch --mode development",
"build": "webpack --mode production",
"test": "jest --collect-coverage",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook --webpack-stats-json",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build --webpack-stats-json",
"svgr": "svgr --out-dir src/shared/components/icons --ignore-existing ../node_modules/@vscode/codicons/src/icons && svgr -d src/shared/components/icons icons/"
},
"main": "./index.js",
Expand All @@ -38,14 +38,15 @@
"vega-util": "1.17.1"
},
"devDependencies": {
"@storybook/addon-essentials": "6.5.16",
"@storybook/addon-interactions": "6.5.16",
"@storybook/addons": "6.5.16",
"@storybook/builder-webpack5": "6.5.16",
"@storybook/addon-essentials": "7.0.7",
"@storybook/addon-interactions": "7.0.7",
"@storybook/addons": "7.0.7",
"@storybook/builder-webpack5": "7.0.7",
"@storybook/manager-webpack5": "6.5.16",
"@storybook/preset-scss": "1.0.3",
"@storybook/react": "6.5.16",
"@storybook/testing-library": "0.0.13",
"@storybook/react": "7.0.7",
"@storybook/react-webpack5": "7.0.7",
"@storybook/testing-library": "0.1.0",
"@svgr/cli": "7.0.0",
"@swc/core": "1.3.51",
"@swc/jest": "0.2.26",
Expand All @@ -72,7 +73,7 @@
"raw-loader": "4.0.2",
"sass": "1.62.0",
"sass-loader": "13.2.2",
"storybook-addon-designs": "6.3.1",
"storybook": "7.0.7",
"storybook-addon-themes": "6.1.0",
"style-loader": "3.3.2",
"ts-loader": "9.4.2",
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/ComparisonTable.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { Meta, Story } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL about import type. That's really neat!

import { configureStore } from '@reduxjs/toolkit'
import { userEvent, within } from '@storybook/testing-library'
import React from 'react'
Expand Down Expand Up @@ -36,7 +36,7 @@ export default {
title: 'Comparison Table'
} as Meta

const Template: Story = ({ plots, revisions }) => {
const Template: StoryFn = ({ plots, revisions }) => {
const store = configureStore({
reducer: plotsReducers
})
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/ComparisonTableHeader.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import React from 'react'
import { DISABLE_CHROMATIC_SNAPSHOTS } from './util'
import { ComparisonTableHeader } from '../plots/components/comparisonTable/ComparisonTableHeader'
Expand All @@ -19,7 +19,7 @@ export default {
title: 'Comparison Table Header'
} as Meta

const Template: Story<{
const Template: StoryFn<{
displayColor: string
name: string
onClicked: () => void
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/ContextMenu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import React from 'react'
import { MessageFromWebviewType } from 'dvc/src/webview/contract'
import { DISABLE_CHROMATIC_SNAPSHOTS } from './util'
Expand All @@ -18,7 +18,7 @@ export default {
title: 'Context Menu'
} as Meta

const Template: Story<ContextMenuProps> = () => {
const Template: StoryFn<ContextMenuProps> = () => {
return (
<WebviewWrapper>
<ContextMenu
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/IconMenu.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import React from 'react'
import { DISABLE_CHROMATIC_SNAPSHOTS } from './util'
import { SelectMenu } from '../shared/components/selectMenu/SelectMenu'
Expand Down Expand Up @@ -82,7 +82,7 @@ export default {
title: 'Icon Menu'
} as Meta

const Template: Story<{
const Template: StoryFn<{
items: IconMenuItemProps[]
}> = ({ items }) => (
<WebviewWrapper>
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/Icons.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story, Meta } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import React from 'react'

import { IconWrapper } from './components/IconWrapper'
Expand Down Expand Up @@ -42,7 +42,7 @@ export default {
title: 'Icons'
} as Meta

const Template: Story = () => {
const Template: StoryFn = () => {
return (
<IconsWrapper>
<IconWrapper name="Add">
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/Plots.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { configureStore } from '@reduxjs/toolkit'
import React from 'react'
import { Provider, useDispatch } from 'react-redux'
import { Story, Meta } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import { userEvent, within } from '@storybook/testing-library'
import {
PlotsData,
Expand Down Expand Up @@ -77,7 +77,7 @@ export default {
title: 'Plots'
} as Meta

const Template: Story<{
const Template: StoryFn<{
data?: PlotsData
}> = ({ data }) => {
const store = configureStore({ reducer: plotsReducers })
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/Ribbon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Story, Meta } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import { Provider, useDispatch } from 'react-redux'
import { configureStore } from '@reduxjs/toolkit'
import { MessageToWebviewType } from 'dvc/src/webview/contract'
Expand Down Expand Up @@ -37,7 +37,7 @@ export default {
title: 'Plots Ribbon'
} as Meta

const Template: Story<{
const Template: StoryFn<{
data?: PlotsData
}> = ({ data }) => {
const store = configureStore({ reducer: plotsReducers })
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/Setup.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story, Meta } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import React from 'react'
import { MessageToWebviewType } from 'dvc/src/webview/contract'
import { SetupData, SetupSection } from 'dvc/src/setup/webview/contract'
Expand Down Expand Up @@ -37,7 +37,7 @@ export default {
title: 'Setup'
} as Meta

const Template: Story = ({ data }) => {
const Template: StoryFn = ({ data }) => {
const app = <App />
window.postMessage(
{
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/Slider.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Story } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import React from 'react'
import { DISABLE_CHROMATIC_SNAPSHOTS } from './util'
import { Slider } from '../shared/components/slider/Slider'
Expand All @@ -14,7 +14,7 @@ export default {
title: 'Slider'
} as Meta

const Template: Story<{
const Template: StoryFn<{
maximum: number
defaultValue: number
label: string
Expand Down
13 changes: 3 additions & 10 deletions webview/src/stories/Table.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { configureStore } from '@reduxjs/toolkit'
import React from 'react'
import { Provider } from 'react-redux'
import { Meta, Story } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'
import { rowsFixtureWithBranches } from 'dvc/src/test/fixtures/expShow/base/rows'
import columnsFixture from 'dvc/src/test/fixtures/expShow/base/columns'
import workspaceChangesFixture from 'dvc/src/test/fixtures/expShow/base/workspaceChanges'
Expand Down Expand Up @@ -104,17 +104,10 @@ export default {
tableData
},
component: Experiments,
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/AuQXbrFj60xA2QXOjo9Z65/Experiments-Panel-%E2%80%A2-496'
},
layout: 'fullscreen'
},
title: 'Table'
} as Meta

const Template: Story<{ tableData: TableDataState }> = ({ tableData }) => {
const Template: StoryFn<{ tableData: TableDataState }> = ({ tableData }) => {
return (
<Provider
store={configureStore({
Expand Down Expand Up @@ -252,7 +245,7 @@ WithNoSortsOrFilters.args = {
}
}

export const Scrolled: Story<{ tableData: TableDataState }> = ({
export const Scrolled: StoryFn<{ tableData: TableDataState }> = ({
tableData
}) => {
return (
Expand Down
4 changes: 2 additions & 2 deletions webview/src/stories/Tooltip.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Story, Meta } from '@storybook/react/types-6-0'
import type { StoryFn, Meta } from '@storybook/react'

import { DISABLE_CHROMATIC_SNAPSHOTS } from './util'
import Tooltip from '../shared/components/tooltip/Tooltip'
Expand All @@ -20,7 +20,7 @@ export default {
title: 'Tooltip'
} as Meta

const Template: Story = args => (
const Template: StoryFn = args => (
<div
style={{
backgroundColor: 'gray',
Expand Down
Loading