Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 906c58b

Browse files
committed
update customViewports. bring in initial viewports
1 parent 3d1451b commit 906c58b

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

.storybook/preview.js

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,60 @@
1-
import {withNextRouter} from 'storybook-addon-next-router'
1+
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport'
22
import {addDecorator} from '@storybook/react'
3-
3+
import {withNextRouter} from 'storybook-addon-next-router'
44
import '../styles/index.css'
55

6-
// This is so that we don't get "Uncaught TypeError: Cannot read property 'prefetch' of null" in stories with a Next.js link component.
6+
/**
7+
* Enable Next.js <Link /> component usage.
8+
*/
79
addDecorator(
810
withNextRouter({
911
path: '/'
1012
})
1113
)
1214

15+
/**
16+
* Custom viewports based on popular Apple devices.
17+
*/
1318
const customViewports = {
14-
mobile: {
15-
name: 'Mobile',
19+
largeMobile: {
20+
name: 'iPhone X/11/12 Pro',
1621
styles: {
17-
width: '375px',
18-
height: '667px'
19-
}
22+
width: '428px',
23+
height: '926px'
24+
},
25+
type: 'mobile'
2026
},
21-
tablet: {
22-
name: 'Tablet',
27+
smallLaptop: {
28+
name: 'MacBook Air 13"',
2329
styles: {
24-
width: '768px',
25-
height: '1024px'
30+
width: '1280px',
31+
height: '800px'
32+
},
33+
type: 'desktop'
34+
},
35+
largeLaptop: {
36+
name: 'MacBook Pro 16"',
37+
styles: {
38+
width: '1536px',
39+
height: '960px'
2640
}
41+
},
42+
destkop: {
43+
name: 'iMac 5k',
44+
styles: {
45+
width: '2048px',
46+
height: '1152px'
47+
},
48+
type: 'desktop'
2749
}
2850
}
2951

3052
export const parameters = {
3153
actions: {argTypesRegex: '^on[A-Z].*'},
3254
viewport: {
33-
viewports: customViewports
55+
viewports: {
56+
...customViewports,
57+
...INITIAL_VIEWPORTS
58+
}
3459
}
3560
}

0 commit comments

Comments
 (0)