add types to storybook config
This commit is contained in:
parent
351e5fa750
commit
15b376905d
|
@ -1,15 +1,20 @@
|
||||||
module.exports = {
|
import { StorybookConfig } from '@storybook/types'
|
||||||
|
|
||||||
|
const config: StorybookConfig = {
|
||||||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
||||||
addons: [
|
addons: [
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
'@storybook/addon-essentials',
|
'@storybook/addon-essentials',
|
||||||
'@storybook/addon-interactions'
|
'@storybook/addon-interactions',
|
||||||
|
'storybook-addon-designs',
|
||||||
],
|
],
|
||||||
framework: {
|
framework: {
|
||||||
name: '@storybook/react-vite',
|
name: '@storybook/react-vite',
|
||||||
options: {}
|
options: {},
|
||||||
},
|
},
|
||||||
docs: {
|
docs: {
|
||||||
autodocs: 'tag'
|
autodocs: 'tag',
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { TamaguiProvider } from '@tamagui/core'
|
import { TamaguiProvider } from '@tamagui/core'
|
||||||
import { config } from '../src'
|
import { config } from '../src'
|
||||||
|
import { Parameters, Decorator } from '@storybook/react'
|
||||||
|
|
||||||
export const parameters = {
|
export const parameters: Parameters = {
|
||||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||||
controls: {
|
controls: {
|
||||||
matchers: {
|
matchers: {
|
||||||
color: /(background|color)$/i,
|
color: /(background|color)$/i,
|
||||||
date: /Date$/
|
date: /Date$/,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const withThemeProvider = (Story, context) => {
|
const withThemeProvider: Decorator = (Story, _context) => {
|
||||||
return (
|
return (
|
||||||
<TamaguiProvider config={config}>
|
<TamaguiProvider config={config}>
|
||||||
<Story />
|
<Story />
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"storybook": "^7.0.0-beta.21",
|
"storybook": "^7.0.0-beta.21",
|
||||||
|
"storybook-addon-designs": "^7.0.0-beta.2",
|
||||||
"vite": "^4.0.4"
|
"vite": "^4.0.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue