This repository was archived by the owner on Feb 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +38
-13
lines changed Expand file tree Collapse file tree 1 file changed +38
-13
lines changed Original file line number Diff line number Diff line change 1
- import { withNextRouter } from 'storybook- addon-next-router '
1
+ import { INITIAL_VIEWPORTS } from '@ storybook/ addon-viewport '
2
2
import { addDecorator } from '@storybook/react'
3
-
3
+ import { withNextRouter } from 'storybook-addon-next-router'
4
4
import '../styles/index.css'
5
5
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
+ */
7
9
addDecorator (
8
10
withNextRouter ( {
9
11
path : '/'
10
12
} )
11
13
)
12
14
15
+ /**
16
+ * Custom viewports based on popular Apple devices.
17
+ */
13
18
const customViewports = {
14
- mobile : {
15
- name : 'Mobile ' ,
19
+ largeMobile : {
20
+ name : 'iPhone X/11/12 Pro ' ,
16
21
styles : {
17
- width : '375px' ,
18
- height : '667px'
19
- }
22
+ width : '428px' ,
23
+ height : '926px'
24
+ } ,
25
+ type : 'mobile'
20
26
} ,
21
- tablet : {
22
- name : 'Tablet ' ,
27
+ smallLaptop : {
28
+ name : 'MacBook Air 13" ' ,
23
29
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'
26
40
}
41
+ } ,
42
+ destkop : {
43
+ name : 'iMac 5k' ,
44
+ styles : {
45
+ width : '2048px' ,
46
+ height : '1152px'
47
+ } ,
48
+ type : 'desktop'
27
49
}
28
50
}
29
51
30
52
export const parameters = {
31
53
actions : { argTypesRegex : '^on[A-Z].*' } ,
32
54
viewport : {
33
- viewports : customViewports
55
+ viewports : {
56
+ ...customViewports ,
57
+ ...INITIAL_VIEWPORTS
58
+ }
34
59
}
35
60
}
You can’t perform that action at this time.
0 commit comments