storybook/docs/snippets/react/my-component-story-configure-viewports.js.mdx
2021-09-03 23:31:04 +01:00

31 lines
659 B
Plaintext

```js
// MyComponent.stories.js | MyComponent.stories.ts | MyComponent.stories.jsx | MyComponent.stories.tsx
import React from 'react';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { MyComponent } from './MyComponent';
export default {
component: MyComponent,
parameters: {
//👇 The viewports object from the Essentials addon
viewport: {
//👇 The viewports you want to use
viewports: INITIAL_VIEWPORTS,
//👇 Your own default viewport
defaultViewport: 'iphone6',
},
},
};
export const MyStory = {
parameters: {
viewport: {
defaultViewport: 'iphonex',
},
},
};
```