Skip to content

Commit

Permalink
Removing storybook-addon-remix-react-router and replacing with simple…
Browse files Browse the repository at this point in the history
… minimal decorator.
  • Loading branch information
patcon committed Oct 15, 2024
1 parent 57ede97 commit 4754380
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 123 deletions.
12 changes: 12 additions & 0 deletions .storybook/decorators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import compdemAdminTheme from '../codebases/compdem/client-admin/src/theme'
import haiDelibTheme from '../codebases/UT-HAI/client-deliberation/src/theme'
import { Provider as ReduxProvider } from 'react-redux'
import configureStore from '../codebases/compdem/client-admin/src/store'
import { MemoryRouter } from 'react-router'

const store = configureStore()

Expand All @@ -30,3 +31,14 @@ export const svgDecorator = (Story) => (
<Story />
</svg>
)

// If we need more, there's an old addon for React Router v5.
// See: https://github.com/gvaldambrini/storybook-router
//
// If we ever migrate to React Router v6, we can use the new addon.
// See: https://github.com/JesusTheHun/storybook-addon-remix-react-router
export const withRouter = (Story) => (
<MemoryRouter initialEntries={['/']}>
<Story />
</MemoryRouter>
)
1 change: 0 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const config = {
"@storybook/addon-a11y",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
"storybook-addon-remix-react-router",
"storybook-branch-switcher",
],
framework: {
Expand Down
182 changes: 78 additions & 104 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-redux": "7.2.2",
"react-router-dom": "^5.2.0",
"redux-thunk": "~2.3.0",
"storybook": "^8.3.2",
"storybook-addon-remix-react-router": "^3.0.0",
"storybook-branch-switcher": "^0.5.0"
},
"dependencies": {
Expand Down
4 changes: 1 addition & 3 deletions stories/UT-HAI/client-deliberation/InteriorHeader.stories.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react'
import InteriorHeader from '../../../codebases/UT-HAI/client-deliberation/src/components/interior-header'
import { withDelibThemeUi } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router'

import { withDelibThemeUi, withRouter } from '../../../.storybook/decorators'

export default {
component: InteriorHeader,
Expand Down
3 changes: 1 addition & 2 deletions stories/compdem/client-admin/CreateUser.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import CreateUser from '../../../codebases/compdem/client-admin/src/components/landers/createuser'
import { withThemeUi, withRedux } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router'
import { withThemeUi, withRedux, withRouter } from '../../../.storybook/decorators'

export default {
component: CreateUser,
Expand Down
3 changes: 1 addition & 2 deletions stories/compdem/client-admin/Header.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import Header from '../../../codebases/compdem/client-admin/src/components/landers/lander-header'
import { withThemeUi } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router'
import { withThemeUi, withRouter } from '../../../.storybook/decorators'

export default {
component: Header,
Expand Down
3 changes: 1 addition & 2 deletions stories/compdem/client-admin/Home.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import Home from '../../../codebases/compdem/client-admin/src/components/landers/home'
import { withThemeUi } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router'
import { withThemeUi, withRouter } from '../../../.storybook/decorators'

export default {
component: Home,
Expand Down
3 changes: 1 addition & 2 deletions stories/compdem/client-admin/Layout.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import Layout from '../../../codebases/compdem/client-admin/src/components/landers/lander-layout'
import { withThemeUi } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router';
import { withThemeUi, withRouter } from '../../../.storybook/decorators'

export default {
component: Layout,
Expand Down
3 changes: 1 addition & 2 deletions stories/compdem/client-admin/Press.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import Press from '../../../codebases/compdem/client-admin/src/components/landers/press'
import { withThemeUi } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router';
import { withThemeUi, withRouter } from '../../../.storybook/decorators'

export default {
component: Press,
Expand Down
3 changes: 1 addition & 2 deletions stories/compdem/client-admin/SignIn.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import SignIn from '../../../codebases/compdem/client-admin/src/components/landers/signin'
import { withThemeUi, withRedux } from '../../../.storybook/decorators'
import { withRouter } from 'storybook-addon-remix-react-router'
import { withThemeUi, withRedux, withRouter } from '../../../.storybook/decorators'

export default {
component: SignIn,
Expand Down
Loading

0 comments on commit 4754380

Please sign in to comment.