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