Skip to content

Commit

Permalink
Merge pull request #393 from cagov/kalvin-fix-storybook
Browse files Browse the repository at this point in the history
Update Storybook to work with Next 11
  • Loading branch information
kalvinwang authored Aug 19, 2021
2 parents 9a9274d + b419412 commit f9e28e3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 27 deletions.
1 change: 1 addition & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'storybook-addon-i18next',
'storybook-addon-next-router',
// Handle SCSS modules
{
name: '@storybook/preset-scss',
Expand Down
4 changes: 4 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import '../styles/globals.scss'
import i18n from 'i18next'
import { I18nextProvider, initReactI18next } from 'react-i18next'
import { withI18next } from 'storybook-addon-i18next'
import { RouterContext } from 'next/dist/shared/lib/router-context'

import enCommon from '../public/locales/en/common.json'
import enClaimDetails from '../public/locales/en/claim-details.json'
Expand All @@ -23,6 +24,9 @@ export const parameters = {
date: /Date$/,
},
},
nextRouter: {
Provider: RouterContext.Provider,
},
options: {
storySort: {
method: 'alphabetical',
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
},
"devDependencies": {
"@babel/core": "^7.13.14",
"@storybook/addon-a11y": "^6.3.4",
"@storybook/addon-actions": "^6.3.4",
"@storybook/addon-essentials": "^6.3.4",
"@storybook/addon-links": "^6.3.4",
"@storybook/addons": "^6.3.4",
"@storybook/addon-a11y": "^6.3.7",
"@storybook/addon-actions": "^6.3.7",
"@storybook/addon-essentials": "^6.3.7",
"@storybook/addon-links": "^6.3.7",
"@storybook/addons": "^6.3.7",
"@storybook/preset-scss": "^1.0.3",
"@storybook/preset-typescript": "^3.0.0",
"@storybook/react": "^6.3.4",
"@storybook/theming": "^6.3.4",
"@storybook/react": "^6.3.7",
"@storybook/theming": "^6.3.7",
"@testing-library/dom": "^7.30.0",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
Expand Down Expand Up @@ -90,9 +90,9 @@
"react-test-renderer": "^17.0.1",
"sass": "^1.32.8",
"sass-loader": "^10.1.1",
"storybook": "^6.3.4",
"storybook": "^6.3.7",
"storybook-addon-i18next": "^1.3.0",
"storybook-addon-next-router": "^2.0.4",
"storybook-addon-next-router": "^3.0.7",
"style-loader": "^2.0.0",
"typescript": "^4.3.5"
},
Expand Down
2 changes: 0 additions & 2 deletions stories/ClaimDetails.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Story, Meta } from '@storybook/react'
import { withNextRouter } from 'storybook-addon-next-router'

import { ClaimDetails as ClaimDetailsComponent, ClaimDetailsProps } from '../components/ClaimDetails'

export default {
title: 'Component/Page Section/Claim Details',
component: ClaimDetailsComponent,
decorators: [withNextRouter],
argTypes: {
programType: {
control: {
Expand Down
2 changes: 0 additions & 2 deletions stories/LanguageSwitcher.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Story, Meta } from '@storybook/react'
import { withNextRouter } from 'storybook-addon-next-router'

import { LanguageSwitcher as LanguageSwitcherComponent, LanguageSwitcherProps } from '../components/LanguageSwitcher'

export default {
title: 'Component/Atoms/Language Switcher',
component: LanguageSwitcherComponent,
decorators: [withNextRouter],
} as Meta

const Template: Story<LanguageSwitcherProps> = (args) => <LanguageSwitcherComponent {...args} />
Expand Down
2 changes: 0 additions & 2 deletions stories/Page.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Story, Meta } from '@storybook/react'
import { withNextRouter } from 'storybook-addon-next-router'

import Home, { HomeProps } from '../pages/index'
import apiGatewayStub from '../utils/apiGatewayStub'
Expand All @@ -11,7 +10,6 @@ import { getNumericEnumKeys } from '../utils/numericEnum'
export default {
title: 'Claim Tracker/Page',
component: Home,
decorators: [withNextRouter],
argTypes: {
scenario: {
options: getNumericEnumKeys(ScenarioType),
Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@storybook/addon-a11y@^6.3.4":
"@storybook/addon-a11y@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/addon-a11y/-/addon-a11y-6.3.7.tgz#a802455f2d932eda07314e3d44a96c94bbd22b3d"
integrity sha512-Z5Lhxm8r5CkPW9FYf6zmAk9c7IhUeUQZxKZeEWGZdOvcjQ32rtg4IYvO2SHgWNrEKBdxxFm3pMiyK3wylQLfsQ==
Expand All @@ -2029,7 +2029,7 @@
ts-dedent "^2.0.0"
util-deprecate "^1.0.2"

"@storybook/[email protected]", "@storybook/addon-actions@^6.3.4":
"@storybook/[email protected]", "@storybook/addon-actions@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-6.3.7.tgz#b25434972bef351aceb3f7ec6fd66e210f256aac"
integrity sha512-CEAmztbVt47Gw1o6Iw0VP20tuvISCEKk9CS/rCjHtb4ubby6+j/bkp3pkEUQIbyLdHiLWFMz0ZJdyA/U6T6jCw==
Expand Down Expand Up @@ -2134,7 +2134,7 @@
ts-dedent "^2.0.0"
util-deprecate "^1.0.2"

"@storybook/addon-essentials@^6.3.4":
"@storybook/addon-essentials@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/addon-essentials/-/addon-essentials-6.3.7.tgz#5af605ab705e938c5b25a7e19daa26e5924fd4e4"
integrity sha512-ZWAW3qMFrrpfSekmCZibp/ivnohFLJdJweiIA0CLnuCNuuK9kQdpFahWdvyBy5NlCj3UJwB7epTZYZyHqYW7UQ==
Expand All @@ -2154,7 +2154,7 @@
storybook-addon-outline "^1.4.1"
ts-dedent "^2.0.0"

"@storybook/addon-links@^6.3.4":
"@storybook/addon-links@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/addon-links/-/addon-links-6.3.7.tgz#f273abba6d056794a4aa920b2fa9639136e6747f"
integrity sha512-/8Gq18o1DejP3Om0ZOJRkMzW5FoHqoAmR0pFx4DipmNu5lYy7V3krLw4jW4qja1MuQkZ53MGh08FJOoAc2RZvQ==
Expand Down Expand Up @@ -2207,7 +2207,7 @@
prop-types "^15.7.2"
regenerator-runtime "^0.13.7"

"@storybook/[email protected]", "@storybook/addons@^6.3.0", "@storybook/addons@^6.3.4":
"@storybook/[email protected]", "@storybook/addons@^6.3.0", "@storybook/addons@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-6.3.7.tgz#7c6b8d11b65f67b1884f6140437fe996dc39537a"
integrity sha512-9stVjTcc52bqqh7YQex/LpSjJ4e2Czm4/ZYDjIiNy0p4OZEx+yLhL5mZzMWh2NQd6vv+pHASBSxf2IeaR5511A==
Expand Down Expand Up @@ -2806,7 +2806,7 @@
react-docgen-typescript "^2.0.0"
tslib "^2.0.0"

"@storybook/react@^6.3.4":
"@storybook/react@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/react/-/react-6.3.7.tgz#b15259aeb4cdeef99cc7f09d21db42e3ecd7a01a"
integrity sha512-4S0iCQIzgi6PdAtV2sYw4uL57yIwbMInNFSux9CxPnVdlxOxCJ+U8IgTxD4tjkTvR4boYSEvEle46ns/bwg5iQ==
Expand Down Expand Up @@ -2908,7 +2908,7 @@
resolve-from "^5.0.0"
ts-dedent "^1.1.0"

"@storybook/[email protected]", "@storybook/theming@^6.3.4":
"@storybook/[email protected]", "@storybook/theming@^6.3.7":
version "6.3.7"
resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.3.7.tgz#6daf9a21b26ed607f3c28a82acd90c0248e76d8b"
integrity sha512-GXBdw18JJd5jLLcRonAZWvGGdwEXByxF1IFNDSOYCcpHWsMgTk4XoLjceu9MpXET04pVX51LbVPLCvMdggoohg==
Expand Down Expand Up @@ -13320,10 +13320,10 @@ storybook-addon-i18next@^1.3.0:
prop-types "^15.7.2"
react-i18next "^11.3.3"

storybook-addon-next-router@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/storybook-addon-next-router/-/storybook-addon-next-router-2.0.4.tgz#205a79b90ddb7a04b3da0ba2b613cde66790b68e"
integrity sha512-PAlAVA2joJC36r2uRU7pL5tNPqcOlcgJNuWyyiPAG6f/sptBK4EdOKUUdU0X9NBVV6BCkiwbLH/kkPmWYRxiFw==
storybook-addon-next-router@^3.0.7:
version "3.0.7"
resolved "https://registry.yarnpkg.com/storybook-addon-next-router/-/storybook-addon-next-router-3.0.7.tgz#38bb9f76a3f93560e3e374d7c8f7702021fa6ab5"
integrity sha512-D8cRPG5RwqVceHdaSeicaoJywKfwzdJHuwASLBaFdIfnMUAlCPmXjaYTGs3o5prKP2Mpdi5rpLCJMIaMBCdBeQ==

storybook-addon-outline@^1.4.1:
version "1.4.1"
Expand All @@ -13336,7 +13336,7 @@ storybook-addon-outline@^1.4.1:
"@storybook/core-events" "^6.3.0"
ts-dedent "^2.1.1"

storybook@^6.3.4:
storybook@^6.3.7:
version "6.3.7"
resolved "https://registry.yarnpkg.com/storybook/-/storybook-6.3.7.tgz#33776e29d954990ac65e4a8f88bb495c4cb27fa4"
integrity sha512-SO1NPg7bl9/88TjGBCVGPaNcWur9MPjmJzDI/fg949uBT0+zNI3+Bz/7r5L90slsifNVlXrk4DmU5g60sqZPvQ==
Expand Down

0 comments on commit f9e28e3

Please sign in to comment.