add types to storybook config

This commit is contained in:
Pavel Prichodko 2023-01-13 15:52:08 +01:00
parent 351e5fa750
commit 15b376905d
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
3 changed files with 17 additions and 10 deletions

View File

@ -1,15 +1,20 @@
module.exports = {
import { StorybookConfig } from '@storybook/types'
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions'
'@storybook/addon-interactions',
'storybook-addon-designs',
],
framework: {
name: '@storybook/react-vite',
options: {}
options: {},
},
docs: {
autodocs: 'tag'
}
autodocs: 'tag',
},
}
export default config

View File

@ -1,18 +1,19 @@
import React from 'react'
import { TamaguiProvider } from '@tamagui/core'
import { config } from '../src'
import { Parameters, Decorator } from '@storybook/react'
export const parameters = {
export const parameters: Parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
}
date: /Date$/,
},
},
}
const withThemeProvider = (Story, context) => {
const withThemeProvider: Decorator = (Story, _context) => {
return (
<TamaguiProvider config={config}>
<Story />

View File

@ -40,6 +40,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.0.0-beta.21",
"storybook-addon-designs": "^7.0.0-beta.2",
"vite": "^4.0.4"
}
}