Skip to content

Commit

Permalink
feat: add disable feature in the panel (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
nutboltu authored Sep 30, 2022
1 parent 80a7979 commit fbcc357
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/mock-addon-docs/stories/docs/advanced-setup.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ You can set <strong>global configuration</strong> for the addon. Go to the `.sto
| ---------- | :------------------------------------------------------------------------------------------ | :------ |
| `globalMockData` | An array of mock objects which will add in every story | [] |
| `refreshStoryOnUpdate` | This re-render the story if there's any data changes | false |
| `disable` | This disables the panel from all the stories | false |


```js
Expand All @@ -38,6 +39,7 @@ export const parameters = {
response: {},
}],
refreshStoryOnUpdate: true, // This re-render the story if there's any data changes
disable: true, // This disables the panel from all the stories
}
...
}
Expand Down Expand Up @@ -148,6 +150,25 @@ FetchCall.parameters = {
],
};
```
<h3 className="subheading">2. Disable the panel for a story</h3>

```js
import React from 'react';
import { FetchExample } from './index';

export default {
title: 'Examples/Fetch',
component: FetchExample,
};

const Template = () => <FetchExample />;

export const FetchCall = Template.bind({});

FetchCall.parameters = {
mockAddonConfigs: { disable: true }
};
```

<Footer
title="User guide"
Expand Down
1 change: 1 addition & 0 deletions packages/mock-addon/src/preset/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ addons.register(ADDON_ID, () => {
title: 'Mock Request',
match: ({ viewMode }) => viewMode === 'story',
render: Panel,
paramKey: 'mockAddonConfigs',
});
});

1 comment on commit fbcc357

@vercel
Copy link

@vercel vercel bot commented on fbcc357 Sep 30, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.