2023-10-06 15:26:08 +00:00
|
|
|
import type { Preview } from '@storybook/react'
|
2023-04-13 22:04:15 +00:00
|
|
|
import { THEME_TYPOGRAPHY_FONT_CATEGORIES } from '../src/components/Theme/constants'
|
|
|
|
import { storybookThemes } from './themes'
|
2023-02-08 20:24:09 +00:00
|
|
|
import { withTheme } from './withTheme.decorator'
|
|
|
|
|
2023-10-06 15:26:08 +00:00
|
|
|
const preview: Preview = {
|
|
|
|
parameters: {
|
|
|
|
...storybookThemes.parameters,
|
|
|
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
|
|
controls: {
|
|
|
|
matchers: {
|
|
|
|
color: /(background|color)$/i,
|
|
|
|
date: /Date$/,
|
|
|
|
},
|
2023-02-08 20:24:09 +00:00
|
|
|
},
|
2023-10-06 15:26:08 +00:00
|
|
|
viewport: {
|
|
|
|
viewports: {
|
|
|
|
...Object.fromEntries(
|
|
|
|
Object.entries(storybookThemes.defaultTheme.breakpoints).map(
|
|
|
|
([key, { width }]) => [
|
|
|
|
key,
|
|
|
|
{
|
|
|
|
name: key,
|
|
|
|
styles: {
|
|
|
|
width: (width > 0 ? width : 360) + 'px',
|
|
|
|
height: 'auto',
|
|
|
|
minHeight: 400,
|
|
|
|
},
|
2023-02-08 20:24:09 +00:00
|
|
|
},
|
2023-10-06 15:26:08 +00:00
|
|
|
],
|
|
|
|
),
|
2023-02-08 20:24:09 +00:00
|
|
|
),
|
2023-10-06 15:26:08 +00:00
|
|
|
},
|
2023-02-08 20:24:09 +00:00
|
|
|
},
|
|
|
|
},
|
2023-10-06 15:26:08 +00:00
|
|
|
decorators: [withTheme],
|
|
|
|
argTypes: {
|
|
|
|
genericFontFamily: {
|
|
|
|
type: {
|
|
|
|
name: 'enum',
|
|
|
|
value: THEME_TYPOGRAPHY_FONT_CATEGORIES,
|
|
|
|
},
|
|
|
|
defaultValue: 'inherit',
|
2023-02-08 20:24:09 +00:00
|
|
|
},
|
2023-10-06 15:26:08 +00:00
|
|
|
},
|
|
|
|
globalTypes: {
|
|
|
|
...storybookThemes.globalTypes,
|
2023-02-08 20:24:09 +00:00
|
|
|
},
|
|
|
|
}
|
2023-04-13 22:04:15 +00:00
|
|
|
|
2023-10-06 15:26:08 +00:00
|
|
|
export default preview
|