Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #45 from lifeiscontent/chore/fix-39
Browse files Browse the repository at this point in the history
chore: fix #39
  • Loading branch information
lifeiscontent authored Nov 30, 2021
2 parents b457310 + c5a8080 commit 4d24f33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- run: npm version ${{ github.event.release.tag_name }}
- run: npm run build
- run: npm run lint
- run: npm publish --tag ${{ github.event.release.target_commitish }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: git push
Expand Down
10 changes: 4 additions & 6 deletions src/decorators.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { action } from '@storybook/addon-actions';
import { StoryContext } from '@storybook/addons';
import { useGlobals } from '@storybook/client-api';
import React from 'react';
import Router, { NextRouter } from 'next/router';
import { action } from '@storybook/addon-actions';
import { StoryContext } from '@storybook/addons';


export const WithNextRouter = (
Story: React.FC<unknown>,
context: StoryContext
): JSX.Element => {
const [{ locale }] = useGlobals();

const { Provider, ...parameters } = context.parameters.nextRouter ?? {};

if (Provider === undefined) throw new Error('NextContext.Provider is undefined, please add it to parameters.nextRouter.Provider');

Router.router = {
locale,
...parameters,
locale: context?.globals?.locale,
route: '/',
pathname: '/',
query: {},
Expand Down Expand Up @@ -54,7 +53,6 @@ export const WithNextRouter = (
},
},
isFallback: false,
...parameters,
} as typeof Router.router;

return (
Expand Down
10 changes: 8 additions & 2 deletions src/preset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
export function config(entry: unknown[] = []): unknown[] {
return [...entry, require.resolve('./preset/addDecorator')];
return [
...entry,
require.resolve('./preset/addDecorator')
];
}

export function managerEntries(entry: unknown[] = []): unknown[] {
return [...entry, require.resolve('./preset/register')];
return [
...entry,
require.resolve('./preset/register')
];
}

0 comments on commit 4d24f33

Please sign in to comment.