Skip to content

Commit

Permalink
[FX-4541] Use BASE viewports in Picasso Storybook (#4018)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashuk authored Nov 28, 2023
1 parent 36b02cf commit 4b274e1
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
import React from 'react'
import 'github-markdown-css/github-markdown-light.css'
import 'happo-plugin-storybook/register'
import { getCheckpoints } from '../packages/picasso/src/test-utils/get-happo-targets/get-checkpoints.ts'

import Picasso from '@toptal/picasso-provider'

const baseViewportCheckpoints = getCheckpoints()
const BASE_VIEWPORTS = {
'extra-small': {
name: 'extra-small',
styles: {
height: '600px',
width: baseViewportCheckpoints[0] + 'px',
},
},
small: {
name: 'small',
styles: {
height: '800px',
width: baseViewportCheckpoints[1] + 'px',
},
},
medium: {
name: 'medium',
styles: {
height: '1000px',
width: baseViewportCheckpoints[2] + 'px',
},
},
large: {
name: 'large',
styles: {
height: '1200px',
width: baseViewportCheckpoints[3] + 'px',
},
},
'extra-large': {
name: 'extra-large',
styles: {
height: '1400px',
// Add 200px of width, otherwise the difference with the previous breakpoint viewport is too small
width: baseViewportCheckpoints[3] + 200 + 'px',
},
},
}

export const parameters = {
layout: 'padded',
a11y: {
element: '.component-section-container',
},
viewport: {
viewports: BASE_VIEWPORTS,
},
}

const loadFonts = TEST_ENV !== 'visual'
Expand Down

0 comments on commit 4b274e1

Please sign in to comment.