File tree Expand file tree Collapse file tree 5 files changed +291
-311
lines changed Expand file tree Collapse file tree 5 files changed +291
-311
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @shopify/polaris ' : patch
3+ ---
4+
5+ Added viewport addon to storybook and matched values to our breakpoints
Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ module.exports = {
1818 files : '**/*.stories.tsx' ,
1919 } ,
2020 ] ,
21- addons : [ '@storybook/addon-a11y' , '@storybook/addon-toolbars' ] ,
21+ addons : [
22+ '@storybook/addon-a11y' ,
23+ '@storybook/addon-toolbars' ,
24+ '@storybook/addon-viewport' ,
25+ ] ,
2226 webpackFinal : ( config ) => {
2327 const extraRules = [
2428 {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import enTranslations from '../locales/en.json';
55import { GridOverlay } from './GridOverlay' ;
66import { RenderPerformanceProfiler } from './RenderPerformanceProfiler' ;
77import { gridOptions } from './manager' ;
8+ import { breakpoints } from '@shopify/polaris-tokens' ;
89
910function StrictModeDecorator ( Story , context ) {
1011 const { strictMode} = context . globals ;
@@ -79,6 +80,17 @@ export const globalTypes = {
7980 } ,
8081 ...gridOptions ,
8182} ;
83+ const viewPorts = Object . entries ( {
84+ ...breakpoints ,
85+ 'breakpoints-xs' : '20rem' , // Replace the 0px xs breakpoint with 320px (20rem) for testing small screens
86+ } ) . map ( ( [ key , value ] ) => {
87+ return {
88+ name : key ,
89+ styles : { width : value , height : '100%' } ,
90+ } ;
91+ } ) ;
92+
93+ export const parameters = { viewport : { viewports : { ...viewPorts } } } ;
8294
8395export const decorators = [
8496 GridOverlayDecorator ,
Original file line number Diff line number Diff line change 8383 "@shopify/postcss-plugin" : " ^5.0.1" ,
8484 "@shopify/react-testing" : " ^4.1.0" ,
8585 "@shopify/storybook-a11y-test" : " 1.0.1" ,
86- "@storybook/addon-a11y" : " ^6.5.9" ,
87- "@storybook/addon-toolbars" : " ^6.5.9" ,
88- "@storybook/builder-webpack5" : " ^6.5.9" ,
89- "@storybook/manager-webpack5" : " ^6.5.9" ,
90- "@storybook/react" : " ^6.5.9" ,
86+ "@storybook/addon-a11y" : " ^6.5.12" ,
87+ "@storybook/addon-toolbars" : " ^6.5.12" ,
88+ "@storybook/addon-viewport" : " ^6.5.12" ,
89+ "@storybook/builder-webpack5" : " ^6.5.12" ,
90+ "@storybook/manager-webpack5" : " ^6.5.12" ,
91+ "@storybook/react" : " ^6.5.12" ,
9192 "@types/node" : " ^16.11.11" ,
9293 "@types/react" : " ^18.0.15" ,
9394 "@types/react-dom" : " ^18.0.6" ,
You can’t perform that action at this time.
0 commit comments