mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 15:31:57 +08:00
The `MINIMAL_VIEWPORTS` is no longer contain 'iphone6' and 'iphonex' in [code](4f5ab9fe9e/addons/viewport/src/defaults.ts
).
In the meantime add `import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';` for more clear example
27 lines
524 B
Plaintext
27 lines
524 B
Plaintext
```js
|
|
// MyComponent.stories.js
|
|
|
|
import React from 'react';
|
|
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
|
|
|
|
export default {
|
|
title: 'Stories',
|
|
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 = () => <div />;
|
|
MyStory.parameters = {
|
|
viewport: {
|
|
defaultViewport: 'iphonex'
|
|
},
|
|
};
|
|
```
|